|
@@ -346,6 +346,7 @@ void dstr_ncopy(struct dstr *dst, const char *array, const size_t len)
|
|
|
|
|
|
dst->array = bmemdup(array, len + 1);
|
|
|
dst->len = len;
|
|
|
+ dst->capacity = len + 1;
|
|
|
|
|
|
dst->array[len] = 0;
|
|
|
}
|
|
@@ -363,6 +364,7 @@ void dstr_ncopy_dstr(struct dstr *dst, const struct dstr *str, const size_t len)
|
|
|
newlen = size_min(len, str->len);
|
|
|
dst->array = bmemdup(str->array, newlen + 1);
|
|
|
dst->len = newlen;
|
|
|
+ dst->capacity = newlen + 1;
|
|
|
|
|
|
dst->array[newlen] = 0;
|
|
|
}
|