Merge branch 'sp/maint-smart-http-sans-100-continue'
[git.git] / vcs-svn / line_buffer.h
blob96ce966a229110e6775cd33ee01a93d5f133404e
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 struct strbuf blob_buffer;
11 FILE *infile;
13 #define LINE_BUFFER_INIT {"", STRBUF_INIT, NULL}
15 int buffer_init(struct line_buffer *buf, const char *filename);
16 int buffer_fdinit(struct line_buffer *buf, int fd);
17 int buffer_deinit(struct line_buffer *buf);
18 void buffer_reset(struct line_buffer *buf);
20 int buffer_tmpfile_init(struct line_buffer *buf);
21 FILE *buffer_tmpfile_rewind(struct line_buffer *buf); /* prepare to write. */
22 long buffer_tmpfile_prepare_to_read(struct line_buffer *buf);
24 char *buffer_read_line(struct line_buffer *buf);
25 char *buffer_read_string(struct line_buffer *buf, uint32_t len);
26 int buffer_read_char(struct line_buffer *buf);
27 void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
28 void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
29 void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
31 #endif