Replaced unneeded calloc() by malloc()
This commit is contained in:
parent
73dd849484
commit
67ee01d77c
4
dynstr.c
4
dynstr.c
|
@ -38,12 +38,12 @@ int dynstr_append(struct dynstr *const d, const char *const format, ...)
|
||||||
if (!d->str)
|
if (!d->str)
|
||||||
{
|
{
|
||||||
new_len = src_len + 1;
|
new_len = src_len + 1;
|
||||||
d->str = calloc(src_len + 1, sizeof *d->str);
|
d->str = malloc(new_len * sizeof *d->str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_len = d->len + src_len + 1;
|
new_len = d->len + src_len + 1;
|
||||||
d->str = realloc(d->str, (d->len + src_len) * sizeof *d->str);
|
d->str = realloc(d->str, new_len * sizeof *d->str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->str)
|
if (d->str)
|
||||||
|
|
Loading…
Reference in New Issue