0a59c73e8b858a44e22620c8b1cb5c4c02c5343e
1#ifndef LINE_BUFFER_H_
2#define LINE_BUFFER_H_
3
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
15int buffer_init(struct line_buffer *buf, const char *filename);
16int buffer_deinit(struct line_buffer *buf);
17char *buffer_read_line(struct line_buffer *buf);
18char *buffer_read_string(struct line_buffer *buf, uint32_t len);
19int buffer_read_char(struct line_buffer *buf);
20void buffer_read_binary(struct line_buffer *buf, struct strbuf *sb, uint32_t len);
21void buffer_copy_bytes(struct line_buffer *buf, uint32_t len);
22void buffer_skip_bytes(struct line_buffer *buf, uint32_t len);
23void buffer_reset(struct line_buffer *buf);
24
25#endif