update names of internal simple_clone funcs to shallow_clone funcs - relates to #780 default tip

Tue, 16 Dec 2025 18:33:12 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 16 Dec 2025 18:33:12 +0100
changeset 1616
bdc04a8e0dd3
parent 1615
5c211187dde9

update names of internal simple_clone funcs to shallow_clone funcs - relates to #780

src/list.c file | annotate | diff | comparison | revisions
src/map.c file | annotate | diff | comparison | revisions
tests/test_hash_map.c file | annotate | diff | comparison | revisions
tests/test_list.c file | annotate | diff | comparison | revisions
--- a/src/list.c	Tue Dec 16 18:32:35 2025 +0100
+++ b/src/list.c	Tue Dec 16 18:33:12 2025 +0100
@@ -828,14 +828,14 @@
     list->collection.advanced_destructor = destr2_bak;
 }
 
-static void* cx_list_simple_clone_func(void *dst, const void *src, const CxAllocator *al, void *data) {
+static void* cx_list_shallow_clone_func(void *dst, const void *src, const CxAllocator *al, void *data) {
     size_t elem_size = *(size_t*)data;
     if (dst == NULL) dst = cxMalloc(al, elem_size);
     if (dst != NULL) memcpy(dst, src, elem_size);
     return dst;
 }
 
-#define use_simple_clone_func(list) cx_list_simple_clone_func, NULL, (void*)&((list)->collection.elem_size)
+#define use_shallow_clone_func(list) cx_list_shallow_clone_func, NULL, (void*)&((list)->collection.elem_size)
 
 int cxListClone(CxList *dst, const CxList *src, cx_clone_func clone_func,
         const CxAllocator *clone_allocator, void *data) {
@@ -1097,19 +1097,19 @@
 }
 
 int cxListCloneShallow(CxList *dst, const CxList *src) {
-    return cxListClone(dst, src, use_simple_clone_func(src));
+    return cxListClone(dst, src, use_shallow_clone_func(src));
 }
 
 int cxListDifferenceShallow(CxList *dst, const CxList *minuend, const CxList *subtrahend) {
-    return cxListDifference(dst, minuend, subtrahend, use_simple_clone_func(minuend));
+    return cxListDifference(dst, minuend, subtrahend, use_shallow_clone_func(minuend));
 }
 
 int cxListIntersectionShallow(CxList *dst, const CxList *src, const CxList *other) {
-    return cxListIntersection(dst, src, other, use_simple_clone_func(src));
+    return cxListIntersection(dst, src, other, use_shallow_clone_func(src));
 }
 
 int cxListUnionShallow(CxList *dst, const CxList *src, const CxList *other) {
-    return cxListUnion(dst, src, other, use_simple_clone_func(src));
+    return cxListUnion(dst, src, other, use_shallow_clone_func(src));
 }
 
 int cxListReserve(CxList *list, size_t capacity) {
--- a/src/map.c	Tue Dec 16 18:32:35 2025 +0100
+++ b/src/map.c	Tue Dec 16 18:33:12 2025 +0100
@@ -142,14 +142,14 @@
     map->collection.advanced_destructor = destr2_bak;
 }
 
-static void* cx_map_simple_clone_func(void *dst, const void *src, const CxAllocator *al, void *data) {
+static void* cx_map_shallow_clone_func(void *dst, const void *src, const CxAllocator *al, void *data) {
     size_t elem_size = *(size_t*)data;
     if (dst == NULL) dst = cxMalloc(al, elem_size);
     if (dst != NULL) memcpy(dst, src, elem_size);
     return dst;
 }
 
-#define use_simple_clone_func(map) cx_map_simple_clone_func, NULL, (void*)&((map)->collection.elem_size)
+#define use_shallow_clone_func(map) cx_map_shallow_clone_func, NULL, (void*)&((map)->collection.elem_size)
 
 int cxMapClone(CxMap *dst, const CxMap *src, cx_clone_func clone_func,
         const CxAllocator *clone_allocator, void *data) {
@@ -306,27 +306,27 @@
 }
 
 int cxMapCloneShallow(CxMap *dst, const CxMap *src) {
-    return cxMapClone(dst, src, use_simple_clone_func(src));
+    return cxMapClone(dst, src, use_shallow_clone_func(src));
 }
 
 int cxMapDifferenceShallow(CxMap *dst, const CxMap *minuend, const CxMap *subtrahend) {
-    return cxMapDifference(dst, minuend, subtrahend, use_simple_clone_func(minuend));
+    return cxMapDifference(dst, minuend, subtrahend, use_shallow_clone_func(minuend));
 }
 
 int cxMapListDifferenceShallow(CxMap *dst, const CxMap *src, const CxList *keys) {
-    return cxMapListDifference(dst, src, keys, use_simple_clone_func(src));
+    return cxMapListDifference(dst, src, keys, use_shallow_clone_func(src));
 }
 
 int cxMapIntersectionShallow(CxMap *dst, const CxMap *src, const CxMap *other) {
-    return cxMapIntersection(dst, src, other, use_simple_clone_func(src));
+    return cxMapIntersection(dst, src, other, use_shallow_clone_func(src));
 }
 
 int cxMapListIntersectionShallow(CxMap *dst, const CxMap *src, const CxList *keys) {
-    return cxMapListIntersection(dst, src, keys, use_simple_clone_func(src));
+    return cxMapListIntersection(dst, src, keys, use_shallow_clone_func(src));
 }
 
 int cxMapUnionShallow(CxMap *dst, const CxMap *src) {
-    return cxMapUnion(dst, src, use_simple_clone_func(src));
+    return cxMapUnion(dst, src, use_shallow_clone_func(src));
 }
 
 int cxMapCompare(const CxMap *map, const CxMap *other) {
--- a/tests/test_hash_map.c	Tue Dec 16 18:32:35 2025 +0100
+++ b/tests/test_hash_map.c	Tue Dec 16 18:33:12 2025 +0100
@@ -1167,7 +1167,7 @@
     cxMapFree(s2);
 }
 
-CX_TEST(test_hash_map_simple_clones) {
+CX_TEST(test_hash_map_shallow_clones) {
     int v = 47; // the value does not matter in this test
     CxMap *a = cxHashMapCreate(NULL, sizeof(int), 0);
     cxMapPut(a, "k1", &v);
@@ -1692,7 +1692,7 @@
     cx_test_register(suite, test_hash_map_union);
     cx_test_register(suite, test_hash_map_union_ptr);
     cx_test_register(suite, test_hash_map_union_alloc_fail);
-    cx_test_register(suite, test_hash_map_simple_clones);
+    cx_test_register(suite, test_hash_map_shallow_clones);
     cx_test_register(suite, test_hash_map_compare);
     cx_test_register(suite, test_empty_map_no_ops);
     cx_test_register(suite, test_empty_map_size);
--- a/tests/test_list.c	Tue Dec 16 18:32:35 2025 +0100
+++ b/tests/test_list.c	Tue Dec 16 18:33:12 2025 +0100
@@ -3097,7 +3097,7 @@
     }
 }
 
-CX_TEST(test_list_simple_clones) {
+CX_TEST(test_list_shallow_clones) {
 
     int a[] = {1, 2, 5, 8, 10};
     int b[] = {1, 3, 5, 7, 9, 11};
@@ -3652,7 +3652,7 @@
     cx_test_register(suite, test_list_intersection_sorted);
     cx_test_register(suite, test_list_intersection_unsorted_alloc_fail);
     cx_test_register(suite, test_list_intersection_sorted_alloc_fail);
-    cx_test_register(suite, test_list_simple_clones);
+    cx_test_register(suite, test_list_shallow_clones);
 
     return suite;
 }

mercurial