vcs-svn: collect line_buffer data in a struct

Prepare for the line_buffer lib to support input from multiple files,
by collecting global state in a struct that can be easily passed
around.

No API change yet.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
This commit is contained in:
Jonathan Nieder
2010-10-10 21:39:21 -05:00
parent deadcef4c1
commit d350822fa7
2 changed files with 33 additions and 23 deletions

View File

@ -1,6 +1,17 @@
#ifndef LINE_BUFFER_H_
#define LINE_BUFFER_H_
#include "strbuf.h"
#define LINE_BUFFER_LEN 10000
struct line_buffer {
char line_buffer[LINE_BUFFER_LEN];
struct strbuf blob_buffer;
FILE *infile;
};
#define LINE_BUFFER_INIT {"", STRBUF_INIT, NULL}
int buffer_init(const char *filename);
int buffer_deinit(void);
char *buffer_read_line(void);