diff -r 6986e9ed70f3 -r dd9dcbb39c2f src/map.c --- a/src/map.c Fri Oct 24 21:15:14 2025 +0200 +++ b/src/map.c Sat Oct 25 21:12:59 2025 +0200 @@ -138,38 +138,37 @@ map->collection.advanced_destructor = destr2_bak; } -size_t cxMapClone(CxMap *dst, const CxMap *src, cx_clone_func clone_func, +int cxMapClone(CxMap *dst, const CxMap *src, cx_clone_func clone_func, const CxAllocator *clone_allocator, void *data) { CxMapIterator src_iter = cxMapIterator(src); - size_t i = 0; if (cxCollectionStoresPointers(dst)) { - for (; i < cxMapSize(src); i++) { + for (size_t i = 0; i < cxMapSize(src); i++) { const CxMapEntry *entry = cxIteratorCurrent(src_iter); void **dst_mem = cxMapEmplace(dst, *(entry->key)); if (dst_mem == NULL) { - return i; + return 1; } void *dst_ptr = clone_func(NULL, entry->value, clone_allocator, data); if (dst_ptr == NULL) { cx_map_remove_uninitialized_entry(dst, *(entry->key)); - return i; + return 1; } *dst_mem = dst_ptr; cxIteratorNext(src_iter); } } else { - for (; i < cxMapSize(src); i++) { + for (size_t i = 0; i < cxMapSize(src); i++) { const CxMapEntry *entry = cxIteratorCurrent(src_iter); void *dst_mem = cxMapEmplace(dst, *(entry->key)); if (dst_mem == NULL) { - return i; + return 1; } if (clone_func(dst_mem, entry->value, clone_allocator, data) == NULL) { cx_map_remove_uninitialized_entry(dst, *(entry->key)); - return i; + return 1; } cxIteratorNext(src_iter); } } - return i; -} \ No newline at end of file + return 0; +}