From dc8474d9034d9281463bb69f7f7a922e3ea713ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 Feb 2019 11:25:37 +0100 Subject: Normalize and improve INIT & FREE macros. --- strbuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index e4dfb803..874aea4f 100644 --- a/strbuf.c +++ b/strbuf.c @@ -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; -- cgit v1.2.3