diff options
Diffstat (limited to 'lib/abuf.c')
-rw-r--r-- | lib/abuf.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/abuf.c b/lib/abuf.c index 61adf7fc6b1..3cbe320fb08 100644 --- a/lib/abuf.c +++ b/lib/abuf.c @@ -119,6 +119,15 @@ void abuf_init_set(struct abuf *abuf, void *data, size_t size) abuf_set(abuf, data, size); } +bool abuf_init_size(struct abuf *buf, size_t size) +{ + abuf_init(buf); + if (!abuf_realloc(buf, size)) + return false; + + return true; +} + void abuf_init_const(struct abuf *abuf, const void *data, size_t size) { /* for now there is no flag indicating that the abuf data is constant */ |