aboutsummaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-23 11:30:36 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-23 11:30:36 +0100
commit8596f5307ce55ff362d9d22f0b1310f341b0b1e7 (patch)
tree08e8b924d528b29c5adfba505b8006703d479886 /strbuf.c
parentrest (diff)
downloadcalp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.gz
calp-8596f5307ce55ff362d9d22f0b1310f341b0b1e7.tar.xz
Something.
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 02f29336..37b0cf3e 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -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);