aboutsummaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-21 11:32:33 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-21 11:32:33 +0100
commitd5a5ce02552c4d58c34226eaa0b9c71743630a32 (patch)
treecd73d4fbcf95913da90a2195e99b7cb369f16b17 /strbuf.c
parentAdd closedir. (diff)
downloadcalp-d5a5ce02552c4d58c34226eaa0b9c71743630a32.tar.gz
calp-d5a5ce02552c4d58c34226eaa0b9c71743630a32.tar.xz
Bunch of renames + macros.
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/strbuf.c b/strbuf.c
index 48702cf8..f6aad92a 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -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;