aboutsummaryrefslogtreecommitdiff
path: root/collections/vector/vector.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/vector/vector.c')
-rw-r--r--collections/vector/vector.c9
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)