--- a/src/array_list.c Sun Dec 29 15:24:20 2024 +0100 +++ b/src/array_list.c Sun Dec 29 16:56:13 2024 +0100 @@ -179,7 +179,7 @@ *array, newcap, elem_size, reallocator ); if (newmem == NULL) { - return 1; + return 1; // LCOV_EXCL_LINE } // store new pointer @@ -365,7 +365,7 @@ if (new_mem == NULL) { // give it up right away, there is no contract // that requires us to insert as much as we can - return 1; + return 1; // LCOV_EXCL_LINE } *target = new_mem; *capacity = new_capacity; @@ -779,7 +779,7 @@ } // just move the elements to the left - int result = cx_array_copy( + cx_array_copy( &arl->data, &list->collection.size, &arl->capacity, @@ -791,9 +791,6 @@ &arl->reallocator ); - // cx_array_copy cannot fail, array cannot grow - assert(result == 0); - // decrease the size list->collection.size -= remove; @@ -862,7 +859,8 @@ if (1 == cx_arl_remove(list, i, 1, NULL)) { return i; } else { - return -1; + // should be unreachable + return -1; // LCOV_EXCL_LINE } } else { return i; @@ -1019,10 +1017,10 @@ // allocate the array after the real elem_size is known list->data = cxCalloc(allocator, initial_capacity, elem_size); - if (list->data == NULL) { + if (list->data == NULL) { // LCOV_EXCL_START cxFree(allocator, list); return NULL; - } + } // LCOV_EXCL_STOP // configure the reallocator list->reallocator = cx_array_reallocator(allocator, NULL);