~emersion/mrsh

ref: 9371d6094e78645f0ec0c85b6cd5b6c8ec9638fc mrsh/include/buffer.h -rw-r--r-- 400 bytes
9371d609Drew DeVault Implement times, : builtins 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef _BUFFER_H
#define _BUFFER_H

struct buffer {
	char *data;
	size_t len, cap;
};

char *buffer_add(struct buffer *buf, size_t size);
bool buffer_append(struct buffer *buf, char *data, size_t size);
bool buffer_append_char(struct buffer *buf, char c);
/**
 * Get the buffer's current data and reset it.
 */
char *buffer_steal(struct buffer *buf);
void buffer_finish(struct buffer *buf);

#endif