summaryrefslogtreecommitdiffstats
path: root/libdimension/array.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-05-07 00:38:30 +0000
committerTavian Barnes <tavianator@gmail.com>2009-05-07 00:38:30 +0000
commitb59dc1d44fb9d56bf9c0949f6747badc5b5c2432 (patch)
tree65d1c2a0677b6d10fe54b2791762ed6e91f027dc /libdimension/array.c
parent4cd8d7439110f2e674a6f6e182a13a67620aa9d1 (diff)
downloaddimension-b59dc1d44fb9d56bf9c0949f6747badc5b5c2432.tar.xz
Fix array bugs.
Diffstat (limited to 'libdimension/array.c')
-rw-r--r--libdimension/array.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libdimension/array.c b/libdimension/array.c
index 5e86f64..b095654 100644
--- a/libdimension/array.c
+++ b/libdimension/array.c
@@ -24,14 +24,14 @@
dmnsn_array *
dmnsn_new_array(size_t obj_size)
{
- dmnsn_array array = malloc(sizeof(array));
+ dmnsn_array *array = malloc(sizeof(array));
if (array) {
- array.obj_size = obj_size;
- array.length = 0;
- array.capacity = 4; /* Start with capacity of 4 */
+ array->obj_size = obj_size;
+ array->length = 0;
+ array->capacity = 4; /* Start with capacity of 4 */
- array.ptr = malloc(array.capacity*array.obj_size);
- if (!array.ptr) {
+ array->ptr = malloc(array->capacity*array->obj_size);
+ if (!array->ptr) {
free(array);
return NULL;
}
@@ -89,7 +89,7 @@ dmnsn_array_resize(dmnsn_array *array, size_t length)
void dmnsn_delete_array(dmnsn_array *array) {
if (array) {
- free(array.ptr);
+ free(array->ptr);
free(array);
}
}