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
     1.1 --- a/src/array.c	Sat Aug 10 08:47:25 2019 +0200
     1.2 +++ b/src/array.c	Sat Aug 10 09:47:59 2019 +0200
     1.3 @@ -121,7 +121,7 @@
     1.4      }
     1.5  }
     1.6  
     1.7 -void ucx_array_free(UcxArray *array) {
     1.8 +void ucx_array_destroy(UcxArray *array) {
     1.9      alfree(array->allocator, array->data);
    1.10      array->data = NULL;
    1.11      array->capacity = array->size = 0;
     2.1 --- a/src/ucx/array.h	Sat Aug 10 08:47:25 2019 +0200
     2.2 +++ b/src/ucx/array.h	Sat Aug 10 09:47:59 2019 +0200
     2.3 @@ -126,9 +126,9 @@
     2.4   * If the array structure itself has been dynamically allocated, it has to be
     2.5   * freed separately.
     2.6   * 
     2.7 - * @param array the array to free
     2.8 + * @param array the array to destroy
     2.9   */
    2.10 -void ucx_array_free(UcxArray *array);
    2.11 +void ucx_array_destroy(UcxArray *array);
    2.12  
    2.13  /**
    2.14   * Inserts an element at the end of the array.
     3.1 --- a/test/array_tests.c	Sat Aug 10 08:47:25 2019 +0200
     3.2 +++ b/test/array_tests.c	Sat Aug 10 09:47:59 2019 +0200
     3.3 @@ -33,7 +33,7 @@
     3.4      UcxArray array = ucx_array_new(16, sizeof(int));
     3.5      
     3.6      UCX_TEST_BEGIN
     3.7 -    ucx_array_free(&array);
     3.8 +    ucx_array_destroy(&array);
     3.9      UCX_TEST_ASSERT(array.data == NULL, "data pointer not NULL after free");
    3.10      UCX_TEST_ASSERT(array.size == 0, "size not zero after free");
    3.11      UCX_TEST_ASSERT(array.capacity == 0, "capacity not zero after free");
    3.12 @@ -53,7 +53,7 @@
    3.13      UCX_TEST_ASSERT(array.allocator == ucx_default_allocator(),
    3.14              "array not using the default allocator");
    3.15      UCX_TEST_END
    3.16 -    ucx_array_free(&array);
    3.17 +    ucx_array_destroy(&array);
    3.18  }
    3.19  
    3.20  UCX_TEST(test_ucx_array_append) {
    3.21 @@ -88,7 +88,7 @@
    3.22      
    3.23      UCX_TEST_END
    3.24      
    3.25 -    ucx_array_free(&array);
    3.26 +    ucx_array_destroy(&array);
    3.27  }
    3.28  
    3.29  UCX_TEST(test_ucx_array_prepend) {
    3.30 @@ -123,7 +123,7 @@
    3.31      
    3.32      UCX_TEST_END
    3.33      
    3.34 -    ucx_array_free(&array);
    3.35 +    ucx_array_destroy(&array);
    3.36  }
    3.37  
    3.38  UCX_TEST(test_ucx_array_set) {
    3.39 @@ -157,7 +157,7 @@
    3.40      
    3.41      UCX_TEST_END
    3.42      
    3.43 -    ucx_array_free(&array);
    3.44 +    ucx_array_destroy(&array);
    3.45  }
    3.46  
    3.47  UCX_TEST(test_ucx_array_equals) {
    3.48 @@ -214,10 +214,10 @@
    3.49              "compare using memcmp() failed");
    3.50      
    3.51      UCX_TEST_END
    3.52 -    ucx_array_free(&a1);
    3.53 -    ucx_array_free(&a2);
    3.54 -    ucx_array_free(&a3);
    3.55 -    ucx_array_free(&a4);
    3.56 +    ucx_array_destroy(&a1);
    3.57 +    ucx_array_destroy(&a2);
    3.58 +    ucx_array_destroy(&a3);
    3.59 +    ucx_array_destroy(&a4);
    3.60  }
    3.61  
    3.62  UCX_TEST(test_ucx_array_concat) {
    3.63 @@ -253,8 +253,8 @@
    3.64              "arrays of different element size must not be concatenated");
    3.65      
    3.66      UCX_TEST_END
    3.67 -    ucx_array_free(&a1);
    3.68 -    ucx_array_free(&a2);    
    3.69 +    ucx_array_destroy(&a1);
    3.70 +    ucx_array_destroy(&a2);    
    3.71  }
    3.72  
    3.73  UCX_TEST(test_ucx_array_at) {
    3.74 @@ -278,7 +278,7 @@
    3.75      
    3.76      UCX_TEST_END
    3.77      
    3.78 -    ucx_array_free(&array);
    3.79 +    ucx_array_destroy(&array);
    3.80  }
    3.81  
    3.82  UCX_TEST(test_ucx_array_find) {
    3.83 @@ -309,7 +309,7 @@
    3.84          "failed using memcmp()");
    3.85      
    3.86      UCX_TEST_END
    3.87 -    ucx_array_free(&array);
    3.88 +    ucx_array_destroy(&array);
    3.89  }
    3.90  
    3.91  UCX_TEST(test_ucx_array_contains) {
    3.92 @@ -340,7 +340,7 @@
    3.93          "false positive using memcmp()");
    3.94      
    3.95      UCX_TEST_END
    3.96 -    ucx_array_free(&array);
    3.97 +    ucx_array_destroy(&array);
    3.98  }
    3.99  
   3.100  UCX_TEST(test_ucx_array_remove) {
   3.101 @@ -377,7 +377,7 @@
   3.102      UCX_TEST_ASSERT(array.size == 3, "wrong size after fast remove");
   3.103      
   3.104      UCX_TEST_END
   3.105 -    ucx_array_free(&array);
   3.106 +    ucx_array_destroy(&array);
   3.107  }
   3.108  
   3.109  UCX_TEST(test_ucx_array_clone) {
   3.110 @@ -404,8 +404,8 @@
   3.111      
   3.112      UCX_TEST_END
   3.113  
   3.114 -    ucx_array_free(&array);
   3.115 -    ucx_array_free(&copy);
   3.116 +    ucx_array_destroy(&array);
   3.117 +    ucx_array_destroy(&copy);
   3.118  }
   3.119  
   3.120  static int ucx_cmp_int_reverse(const void* x, const void* y, void* data) {
   3.121 @@ -467,8 +467,8 @@
   3.122              "failed for bigger arrays");
   3.123      UCX_TEST_END
   3.124  
   3.125 -    ucx_array_free(&expected);
   3.126 -    ucx_array_free(&array);
   3.127 +    ucx_array_destroy(&expected);
   3.128 +    ucx_array_destroy(&array);
   3.129  }
   3.130  
   3.131  UCX_TEST(test_ucx_array_autogrow) {
   3.132 @@ -494,7 +494,7 @@
   3.133      UCX_TEST_ASSERT(elems[3] == 5 && elems[4] == 5, "corrupt data");
   3.134      
   3.135      UCX_TEST_END
   3.136 -    ucx_array_free(&array);
   3.137 +    ucx_array_destroy(&array);
   3.138  }
   3.139  
   3.140  UCX_TEST(test_ucx_array_shrink) {
   3.141 @@ -505,7 +505,7 @@
   3.142      UCX_TEST_ASSERT(!ucx_array_shrink(&array), "failed");
   3.143      UCX_TEST_ASSERT(array.capacity == 4, "incorrect capacity after shrink");
   3.144      UCX_TEST_END
   3.145 -    ucx_array_free(&array);
   3.146 +    ucx_array_destroy(&array);
   3.147  }
   3.148  
   3.149  UCX_TEST(test_ucx_array_resize) {
   3.150 @@ -523,7 +523,7 @@
   3.151      UCX_TEST_ASSERT(array.size == 4, "incorrect size after resize");
   3.152      
   3.153      UCX_TEST_END
   3.154 -    ucx_array_free(&array);
   3.155 +    ucx_array_destroy(&array);
   3.156  }
   3.157  
   3.158  UCX_TEST(test_ucx_array_reserve) {
   3.159 @@ -538,5 +538,5 @@
   3.160      UCX_TEST_ASSERT(array.capacity == 32, "incorrect capacity after reserve");    
   3.161      
   3.162      UCX_TEST_END
   3.163 -    ucx_array_free(&array);
   3.164 +    ucx_array_destroy(&array);
   3.165  }

mercurial