aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--.gitigore2
-rw-r--r--collections/vector/vector.c9
3 files changed, 9 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..67f17da
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.bak
+*.o
+*.out
+*.html
diff --git a/.gitigore b/.gitigore
deleted file mode 100644
index e5a1669..0000000
--- a/.gitigore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.bak
-*.o
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)