12 extern char gbuf_empty_buffer
[];
14 #define GBUF(name) struct gbuf name = { gbuf_empty_buffer, 0, 0 }
16 static inline void gbuf_clear(struct gbuf
*buf
)
22 static inline size_t gbuf_avail(struct gbuf
*buf
)
25 return buf
->alloc
- buf
->len
- 1;
29 void gbuf_grow(struct gbuf
*buf
, size_t more
);
30 void gbuf_free(struct gbuf
*buf
);
31 void gbuf_add_ch(struct gbuf
*buf
, char ch
);
32 void gbuf_add_bytes(struct gbuf
*buf
, const void *data
, size_t len
);
33 void gbuf_add_str(struct gbuf
*buf
, const char *str
);
34 void gbuf_addf(struct gbuf
*buf
, const char *fmt
, ...) __FORMAT(2, 3);
35 void gbuf_set(struct gbuf
*buf
, int c
, size_t count
);
36 char *gbuf_steal(struct gbuf
*buf
);