6 static int grow(struct vector *vec, int gently)
11 new_alloc = vec->alloc * 3 / 2;
14 new_data = realloc(vec->data, new_alloc * vec->size);
18 perror("vector.c:grow()");
22 vec->alloc = new_alloc;
26 int vector_push(struct vector *vec, const void *data, int gently)
30 if (vec->count == vec->alloc && (rc = grow(vec, gently)))
33 memmove(vec->data + vec->count * vec->size, data, vec->size);
35 memset(vec->data + vec->count * vec->size, 0, vec->size);