renames ucx_array_free() to ucx_array_destroy() feature/array

Sat, 10 Aug 2019 09:47:59 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 10 Aug 2019 09:47:59 +0200
branch
feature/array
changeset 353
135ce35d5108
parent 352
83888029778a
child 354
7fd13b9f8f60

renames ucx_array_free() to ucx_array_destroy()

src/array.c file | annotate | diff | comparison | revisions
src/ucx/array.h file | annotate | diff | comparison | revisions
test/array_tests.c file | annotate | diff | comparison | revisions
--- a/src/array.c	Sat Aug 10 08:47:25 2019 +0200
+++ b/src/array.c	Sat Aug 10 09:47:59 2019 +0200
@@ -121,7 +121,7 @@
     }
 }
 
-void ucx_array_free(UcxArray *array) {
+void ucx_array_destroy(UcxArray *array) {
     alfree(array->allocator, array->data);
     array->data = NULL;
     array->capacity = array->size = 0;
--- a/src/ucx/array.h	Sat Aug 10 08:47:25 2019 +0200
+++ b/src/ucx/array.h	Sat Aug 10 09:47:59 2019 +0200
@@ -126,9 +126,9 @@
  * If the array structure itself has been dynamically allocated, it has to be
  * freed separately.
  * 
- * @param array the array to free
+ * @param array the array to destroy
  */
-void ucx_array_free(UcxArray *array);
+void ucx_array_destroy(UcxArray *array);
 
 /**
  * Inserts an element at the end of the array.
--- a/test/array_tests.c	Sat Aug 10 08:47:25 2019 +0200
+++ b/test/array_tests.c	Sat Aug 10 09:47:59 2019 +0200
@@ -33,7 +33,7 @@
     UcxArray array = ucx_array_new(16, sizeof(int));
     
     UCX_TEST_BEGIN
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
     UCX_TEST_ASSERT(array.data == NULL, "data pointer not NULL after free");
     UCX_TEST_ASSERT(array.size == 0, "size not zero after free");
     UCX_TEST_ASSERT(array.capacity == 0, "capacity not zero after free");
@@ -53,7 +53,7 @@
     UCX_TEST_ASSERT(array.allocator == ucx_default_allocator(),
             "array not using the default allocator");
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_append) {
@@ -88,7 +88,7 @@
     
     UCX_TEST_END
     
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_prepend) {
@@ -123,7 +123,7 @@
     
     UCX_TEST_END
     
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_set) {
@@ -157,7 +157,7 @@
     
     UCX_TEST_END
     
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_equals) {
@@ -214,10 +214,10 @@
             "compare using memcmp() failed");
     
     UCX_TEST_END
-    ucx_array_free(&a1);
-    ucx_array_free(&a2);
-    ucx_array_free(&a3);
-    ucx_array_free(&a4);
+    ucx_array_destroy(&a1);
+    ucx_array_destroy(&a2);
+    ucx_array_destroy(&a3);
+    ucx_array_destroy(&a4);
 }
 
 UCX_TEST(test_ucx_array_concat) {
@@ -253,8 +253,8 @@
             "arrays of different element size must not be concatenated");
     
     UCX_TEST_END
-    ucx_array_free(&a1);
-    ucx_array_free(&a2);    
+    ucx_array_destroy(&a1);
+    ucx_array_destroy(&a2);    
 }
 
 UCX_TEST(test_ucx_array_at) {
@@ -278,7 +278,7 @@
     
     UCX_TEST_END
     
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_find) {
@@ -309,7 +309,7 @@
         "failed using memcmp()");
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_contains) {
@@ -340,7 +340,7 @@
         "false positive using memcmp()");
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_remove) {
@@ -377,7 +377,7 @@
     UCX_TEST_ASSERT(array.size == 3, "wrong size after fast remove");
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_clone) {
@@ -404,8 +404,8 @@
     
     UCX_TEST_END
 
-    ucx_array_free(&array);
-    ucx_array_free(&copy);
+    ucx_array_destroy(&array);
+    ucx_array_destroy(&copy);
 }
 
 static int ucx_cmp_int_reverse(const void* x, const void* y, void* data) {
@@ -467,8 +467,8 @@
             "failed for bigger arrays");
     UCX_TEST_END
 
-    ucx_array_free(&expected);
-    ucx_array_free(&array);
+    ucx_array_destroy(&expected);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_autogrow) {
@@ -494,7 +494,7 @@
     UCX_TEST_ASSERT(elems[3] == 5 && elems[4] == 5, "corrupt data");
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_shrink) {
@@ -505,7 +505,7 @@
     UCX_TEST_ASSERT(!ucx_array_shrink(&array), "failed");
     UCX_TEST_ASSERT(array.capacity == 4, "incorrect capacity after shrink");
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_resize) {
@@ -523,7 +523,7 @@
     UCX_TEST_ASSERT(array.size == 4, "incorrect size after resize");
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }
 
 UCX_TEST(test_ucx_array_reserve) {
@@ -538,5 +538,5 @@
     UCX_TEST_ASSERT(array.capacity == 32, "incorrect capacity after reserve");    
     
     UCX_TEST_END
-    ucx_array_free(&array);
+    ucx_array_destroy(&array);
 }

mercurial