diff options
-rw-r--r-- | membuffer.c | 7 | ||||
-rw-r--r-- | membuffer.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/membuffer.c b/membuffer.c index fd179244b..8ba23ebe2 100644 --- a/membuffer.c +++ b/membuffer.c @@ -55,6 +55,13 @@ static void make_room(struct membuffer *b, unsigned int size) } } +const char *mb_cstring(struct membuffer *b) +{ + make_room(b, 1); + b->buffer[b->len] = 0; + return b->buffer; +} + void put_bytes(struct membuffer *b, const char *str, int len) { make_room(b, len); diff --git a/membuffer.h b/membuffer.h index 2a6ddc7f5..3a7f633be 100644 --- a/membuffer.h +++ b/membuffer.h @@ -23,6 +23,7 @@ extern void flush_buffer(struct membuffer *, FILE *); extern void put_bytes(struct membuffer *, const char *, int); extern void put_string(struct membuffer *, const char *); extern void strip_mb(struct membuffer *); +extern const char *mb_cstring(struct membuffer *); extern __printf(2, 0) void put_vformat(struct membuffer *, const char *, va_list); extern __printf(2, 3) void put_format(struct membuffer *, const char *fmt, ...); |