aboutsummaryrefslogtreecommitdiff
path: root/better_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'better_string.c')
-rw-r--r--better_string.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/better_string.c b/better_string.c
index b3bc931..e601586 100644
--- a/better_string.c
+++ b/better_string.c
@@ -9,9 +9,10 @@ string_t *init_string(char *s) {
die("malloc in init_string");
/* If we pass in NULL we assume that we want to append things to this in the
* future */
- if (s == NULL) {
+ if (s == NULL || strcmp(s, "") == 0) {
str->bufsize = 10;
str->value = calloc(str->bufsize, sizeof(char));
+ str->value[0] = '\0';
if (str->value == NULL)
die("calloc in init_string");
str->length = 0;