diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 11:25:37 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-05 18:06:13 +0100 |
commit | dc8474d9034d9281463bb69f7f7a922e3ea713ee (patch) | |
tree | c3b870ada88f7aaa48918c4eb8b5d865f2f82019 /strbuf.c | |
parent | Work on propper memmory management for linked lists. (diff) | |
download | calp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.gz calp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.xz |
Normalize and improve INIT & FREE macros.
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -7,7 +7,7 @@ #define ERR(s) fprintf(stderr, "\x1B[0;31mERR\x1b[m (strbuf %3i): %s\n", __LINE__, s) #endif -int CONSTRUCTOR_DECL(strbuf) { +INIT_F(strbuf) { this->mem = NULL; this->alloc = 0; this->len = 0; @@ -15,7 +15,7 @@ int CONSTRUCTOR_DECL(strbuf) { return 0; } -int CONSTRUCTOR_DECL(strbuf, size_t len) { +INIT_F(strbuf, size_t len) { this->mem = calloc(sizeof(*this->mem), len); this->alloc = len; this->ptr = 0; @@ -36,7 +36,7 @@ int strbuf_realloc(strbuf* str, size_t len) { } // int strbuf_free(strbuf* str) { -int FREE_DECL(strbuf) { +FREE_F(strbuf) { #ifdef SAFE_STR if (this->mem == NULL) return 1; #endif @@ -121,7 +121,7 @@ int strbuf_init_copy(strbuf* dest, strbuf* src) { } #endif - CONSTRUCT(strbuf, dest, src->len + 1); + INIT(strbuf, dest, src->len + 1); strbuf_copy(dest, src); return 0; |