diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-23 11:30:36 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-23 11:30:36 +0100 |
commit | 8596f5307ce55ff362d9d22f0b1310f341b0b1e7 (patch) | |
tree | 08e8b924d528b29c5adfba505b8006703d479886 /strbuf.c | |
parent | rest (diff) | |
download | calp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.gz calp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.xz |
Something.
Diffstat (limited to 'strbuf.c')
-rw-r--r-- | strbuf.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -22,6 +22,7 @@ strbuf::strbuf () { } int strbuf_realloc(strbuf* str, size_t len) { + fprintf(stderr, "str->mem = %p\n", str->mem); str->mem = (char*) realloc(str->mem, len); str->alloc = len; return 0; @@ -66,11 +67,15 @@ int strbuf_cap(strbuf* s) { strbuf::strbuf(strbuf& src) { // int retval = 0; +#if 0 if (this->alloc < src.len) { /* +1 in length is to have room for '\0'. */ strbuf_realloc(this, src.len + 1); // retval = 1; } +#endif + + this->mem = (char*) calloc(sizeof(*this->mem), src.len + 1); this->len = src.len; memcpy(this->mem, src.mem, src.len); |