mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-28 07:23:07 +01:00
Minor
This commit is contained in:
parent
0ab9be934f
commit
04fc61c901
6
utils.c
6
utils.c
@ -113,11 +113,13 @@ void char_v_append(CharVec *v, char c)
|
|||||||
|
|
||||||
if (v->len + 1 >= v->cap) {
|
if (v->len + 1 >= v->cap) {
|
||||||
v->cap *= 2;
|
v->cap *= 2;
|
||||||
v->buf = realloc(v->buf, v->cap * sizeof(v->buf[0]));
|
void *new = realloc(v->buf, v->cap * sizeof(v->buf[0]));
|
||||||
if (!v->buf) {
|
if (!new) {
|
||||||
|
free(v->buf);
|
||||||
PRINTINTERR(FUNCFAILED("realloc"), ERRNOS);
|
PRINTINTERR(FUNCFAILED("realloc"), ERRNOS);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
v->buf = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->buf[v->len - 1] = c;
|
v->buf[v->len - 1] = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user