vcs-svn: teach line_buffer to handle multiple input files
Collect the line_buffer state in a newly public line_buffer struct. Callers can use multiple line_buffers to manage input from multiple files at a time. svn-fe's delta applier will use this to stream a delta from svnrdump and the preimage it applies to from fast-import at the same time. The tests don't take advantage of the new features, but I think that's okay. It is easier to find lingering examples of nonreentrant code by searching for "static" in line_buffer.c. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
This commit is contained in:
@ -12,12 +12,12 @@ struct line_buffer {
|
||||
};
|
||||
#define LINE_BUFFER_INIT {"", STRBUF_INIT, NULL}
|
||||
|
||||
int buffer_init(const char *filename);
|
||||
int buffer_deinit(void);
|
||||
char *buffer_read_line(void);
|
||||
char *buffer_read_string(uint32_t len);
|
||||
void buffer_copy_bytes(uint32_t len);
|
||||
void buffer_skip_bytes(uint32_t len);
|
||||
void buffer_reset(void);
|
||||
int buffer_init(struct line_buffer *buf, const char *filename);
|
||||
int buffer_deinit(struct line_buffer *buf);
|
||||
char *buffer_read_line(struct line_buffer *buf);
|
||||
char *buffer_read_string(struct line_buffer *buf, uint32_t len);
|
||||
void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
|
||||
void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
|
||||
void buffer_reset(struct line_buffer *buf);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user