]> git.ipfire.org Git - thirdparty/git.git/blame - vcs-svn/line_buffer.h
Merge branch 'jc/checkout-orphan-warning'
[thirdparty/git.git] / vcs-svn / line_buffer.h
CommitLineData
3bbaec00
DB
1#ifndef LINE_BUFFER_H_
2#define LINE_BUFFER_H_
3
d350822f
JN
4#include "strbuf.h"
5
6#define LINE_BUFFER_LEN 10000
7
8struct line_buffer {
9 char line_buffer[LINE_BUFFER_LEN];
10 struct strbuf blob_buffer;
11 FILE *infile;
12};
13#define LINE_BUFFER_INIT {"", STRBUF_INIT, NULL}
14
e5e45ca1 15int buffer_init(struct line_buffer *buf, const char *filename);
cb3f87cf 16int buffer_fdinit(struct line_buffer *buf, int fd);
e5e45ca1 17int buffer_deinit(struct line_buffer *buf);
b1c9b798
JN
18void buffer_reset(struct line_buffer *buf);
19
20int buffer_tmpfile_init(struct line_buffer *buf);
21FILE *buffer_tmpfile_rewind(struct line_buffer *buf); /* prepare to write. */
22long buffer_tmpfile_prepare_to_read(struct line_buffer *buf);
23
e5e45ca1
JN
24char *buffer_read_line(struct line_buffer *buf);
25char *buffer_read_string(struct line_buffer *buf, uint32_t len);
cc193f1f 26int buffer_read_char(struct line_buffer *buf);
e832f43c 27void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
e5e45ca1
JN
28void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
29void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
3bbaec00
DB
30
31#endif