mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-12-01 00:43:08 +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) {
|
||||
v->cap *= 2;
|
||||
v->buf = realloc(v->buf, v->cap * sizeof(v->buf[0]));
|
||||
if (!v->buf) {
|
||||
void *new = realloc(v->buf, v->cap * sizeof(v->buf[0]));
|
||||
if (!new) {
|
||||
free(v->buf);
|
||||
PRINTINTERR(FUNCFAILED("realloc"), ERRNOS);
|
||||
abort();
|
||||
}
|
||||
v->buf = new;
|
||||
}
|
||||
|
||||
v->buf[v->len - 1] = c;
|
||||
|
Loading…
Reference in New Issue
Block a user