diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-24 03:13:14 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-10-24 03:13:14 +0100 |
commit | 3a8f0c8d00bd7c87404763e7c1f9c9e484810869 (patch) | |
tree | 03d5d391782a9cc14576ebd5fb17fb625f1321ae | |
parent | 14dea7c48c1f087167f7cbd6c8ebc4bb9aec2a14 (diff) | |
download | prick-3a8f0c8d00bd7c87404763e7c1f9c9e484810869.tar.gz prick-3a8f0c8d00bd7c87404763e7c1f9c9e484810869.tar.bz2 prick-3a8f0c8d00bd7c87404763e7c1f9c9e484810869.zip |
Use VEC_MULT in vec_ensure_remaining
-rw-r--r-- | vec.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -71,7 +71,7 @@ void vec_ensure_remaining(void **ptr, uint32_t space) if (vec->capacity - vec->size < space) { void *new_vec = NULL; - vec_make(&new_vec, MAX(vec->capacity * 2, vec->size + space)); + vec_make(&new_vec, MAX(vec->capacity * VEC_MULT, vec->size + space)); VEC_SIZE(new_vec) = vec->size; memcpy(new_vec, *ptr, vec->size); vec_free(ptr); @@ -90,7 +90,7 @@ void vec_append(void **ptr, void *data, uint32_t size) { vec_ensure_remaining(ptr, size); vec_t *vec = VEC_GET(*ptr); - memcpy(vec->bytes + vec->size, data, size); + memcpy(*ptr + vec->size, data, size); vec->size += size; } @@ -102,6 +102,7 @@ void vec_clone(void **dest, void **src) memcpy(*dest, *src, VEC_SIZE(*src)); VEC_SIZE(*dest) = VEC_SIZE(*src); } + #endif #endif |