summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/dimension/array.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/libdimension/dimension/array.h b/libdimension/dimension/array.h
index 85543cc..b718021 100644
--- a/libdimension/dimension/array.h
+++ b/libdimension/dimension/array.h
@@ -35,16 +35,6 @@ typedef struct {
size_t obj_size, length, capacity;
} dmnsn_array;
-/* Delete an array */
-DMNSN_INLINE void
-dmnsn_delete_array(dmnsn_array *array)
-{
- if (array) {
- dmnsn_free(array->ptr);
- dmnsn_free(array);
- }
-}
-
/* Array allocation */
DMNSN_INLINE dmnsn_array *
dmnsn_new_array(size_t obj_size)
@@ -52,7 +42,7 @@ dmnsn_new_array(size_t obj_size)
dmnsn_array *array = (dmnsn_array *)dmnsn_malloc(sizeof(dmnsn_array));
array->obj_size = obj_size;
array->length = 0;
- array->capacity = 4; /* Start with capacity of 4 */
+ array->capacity = 2; /* Start with capacity of 2 */
/* Allocate the memory */
array->ptr = dmnsn_malloc(array->capacity*array->obj_size);
@@ -60,6 +50,16 @@ dmnsn_new_array(size_t obj_size)
return array;
}
+/* Delete an array */
+DMNSN_INLINE void
+dmnsn_delete_array(dmnsn_array *array)
+{
+ if (array) {
+ dmnsn_free(array->ptr);
+ dmnsn_free(array);
+ }
+}
+
/* Get the size of the array */
DMNSN_INLINE size_t
dmnsn_array_size(const dmnsn_array *array)