Merge branch 'rs/combine-diff-zero-context-at-the-beginning'
[git/mingw.git] / vcs-svn / line_buffer.h
blob8901f214bafce3917025721137a85d827cd1c1a6
1 #ifndef LINE_BUFFER_H_
2 #define LINE_BUFFER_H_
4 #include "strbuf.h"
6 #define LINE_BUFFER_LEN 10000
8 struct line_buffer {
9 char line_buffer[LINE_BUFFER_LEN];
10 FILE *infile;
12 #define LINE_BUFFER_INIT { "", NULL }
14 int buffer_init(struct line_buffer *buf, const char *filename);
15 int buffer_fdinit(struct line_buffer *buf, int fd);
16 int buffer_deinit(struct line_buffer *buf);
17 void buffer_reset(struct line_buffer *buf);
19 int buffer_tmpfile_init(struct line_buffer *buf);
20 FILE *buffer_tmpfile_rewind(struct line_buffer *buf); /* prepare to write. */
21 long buffer_tmpfile_prepare_to_read(struct line_buffer *buf);
23 int buffer_ferror(struct line_buffer *buf);
24 char *buffer_read_line(struct line_buffer *buf);
25 int buffer_read_char(struct line_buffer *buf);
26 size_t buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, size_t len);
27 /* Returns number of bytes read (not necessarily written). */
28 off_t buffer_copy_bytes(struct line_buffer *buf, off_t len);
29 off_t buffer_skip_bytes(struct line_buffer *buf, off_t len);
31 #endif