diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-01-21 11:32:33 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-01-21 11:32:33 +0100 |
commit | d5a5ce02552c4d58c34226eaa0b9c71743630a32 (patch) | |
tree | cd73d4fbcf95913da90a2195e99b7cb369f16b17 /strbuf.c | |
parent | Add closedir. (diff) | |
download | calp-d5a5ce02552c4d58c34226eaa0b9c71743630a32.tar.gz calp-d5a5ce02552c4d58c34226eaa0b9c71743630a32.tar.xz |
Bunch of renames + macros.
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -5,7 +5,15 @@ #include <stdio.h> #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; |