fix bug in new ptr vector append
This commit is contained in:
parent
5e797ed2c3
commit
f70565325e
@ -140,8 +140,8 @@ int ptr_vector_append(struct ptr_vector *vec, void *p) {
|
|||||||
vec->capacity *= 2;
|
vec->capacity *= 2;
|
||||||
ps = realloc(vec->ptrs, vec->capacity * sizeof(void *));
|
ps = realloc(vec->ptrs, vec->capacity * sizeof(void *));
|
||||||
assert(ps != NULL);
|
assert(ps != NULL);
|
||||||
memset(vec->ptrs + oldcap, 0, (vec->capacity - oldcap) * sizeof(void *));
|
|
||||||
vec->ptrs = ps;
|
vec->ptrs = ps;
|
||||||
|
memset(vec->ptrs + oldcap, 0, (vec->capacity - oldcap) * sizeof(void *));
|
||||||
}
|
}
|
||||||
vec->ptrs[vec->len] = p;
|
vec->ptrs[vec->len] = p;
|
||||||
++vec->len;
|
++vec->len;
|
||||||
|
Reference in New Issue
Block a user