diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2020-12-17 14:03:41 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2020-12-17 14:03:41 -0500 |
commit | f3a5b1d8e756899a0265f16adb237255b585afe3 (patch) | |
tree | 23204ec56b0ffbb3485ff8a727fc24d7d90b8722 /collections/vector | |
parent | 392b0b46e151dbb3e441d1c2dcf361bb39dc7794 (diff) | |
parent | 4e1c2be8b650a9ea13f56565deb407a8e9164d62 (diff) |
Diffstat (limited to 'collections/vector')
-rw-r--r-- | collections/vector/vector.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/collections/vector/vector.c b/collections/vector/vector.c index f14c302..153cf9f 100644 --- a/collections/vector/vector.c +++ b/collections/vector/vector.c @@ -17,8 +17,8 @@ vec *root; { int i; - fprintf(stderr, "VEC[base: %p, end: %p, limit:%p]:\n\t ", - root->base, root->end, root->limit); + fprintf(stderr, "VEC[base: %p, end: %d, limit:%d]:\n\t ", + (void*) root->base, root->end, root->limit); for (i=0; i < root->end; i++){ fprintf(stderr, "[%p]", vec_index(root,i)); } @@ -79,8 +79,9 @@ vec *root; if (!root) return; - root->base = reallocarray(root->base, root->limit * 2, sizeof(void*)); + root->base = realloc(root->base, root->limit * 2 * sizeof(void*)); assert(root->base); + root->limit *= 2; } vec* vec_cp(root) @@ -261,7 +262,7 @@ int n; for (i = root->limit; i < root->end + n; i*=2); - root->base = reallocarray(root->base, i, sizeof(void*)); + root->base = realloc(root->base, i * sizeof(void*)); } void vec_clear(root) |