From d5a5ce02552c4d58c34226eaa0b9c71743630a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 21 Jan 2019 11:32:33 +0100 Subject: Bunch of renames + macros. --- strbuf.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index 48702cf8..f6aad92a 100644 --- a/strbuf.c +++ b/strbuf.c @@ -5,7 +5,15 @@ #include #define ERR(s) fprintf(stderr, "\x1B[0;31mERR\x1b[m (strbuf %3i): %s\n", __LINE__, s) -int init_string(string* str, size_t len) { +int strbuf_init_0(string* str) { + str->mem = NULL; + str->alloc = 0; + str->len = 0; + str->ptr = 0; + return 0; +} + +int strbuf_init_1(string* str, size_t len) { str->mem = malloc(len); str->alloc = len; str->ptr = 0; @@ -96,7 +104,7 @@ int strbuf_init_copy(string* dest, string* src) { } #endif - init_string(dest, src->len + 1); + strbuf_init_1(dest, src->len + 1); copy_strbuf(dest, src); return 0; -- cgit v1.2.3