Thu, 20 Nov 2025 18:51:00 +0100
add coverage exclusion rules to hash_map.c
there is one missing test case left
| src/hash_map.c | file | annotate | diff | comparison | revisions |
--- a/src/hash_map.c Thu Nov 20 18:46:50 2025 +0100 +++ b/src/hash_map.c Thu Nov 20 18:51:00 2025 +0100 @@ -117,7 +117,7 @@ allocator, sizeof(struct cx_hash_map_element_s) + map->collection.elem_size ); - if (e == NULL) return NULL; + if (e == NULL) return NULL; // LCOV_EXCL_LINE // write the value if (value == NULL) { @@ -130,10 +130,10 @@ // copy the key void *kd = cxMalloc(allocator, key.len); - if (kd == NULL) { + if (kd == NULL) { // LCOV_EXCL_START cxFree(allocator, e); return NULL; - } + } // LCOV_EXCL_STOP memcpy(kd, key.data, key.len); e->key.data = kd; e->key.len = key.len; @@ -447,15 +447,16 @@ size_t new_bucket_count = (map->collection.size * 5) >> 1; if (new_bucket_count < hash_map->bucket_count) { + // LCOV_EXCL_START errno = EOVERFLOW; return 1; - } + } // LCOV_EXCL_STOP struct cx_hash_map_element_s **new_buckets = cxCalloc( map->collection.allocator, new_bucket_count, sizeof(struct cx_hash_map_element_s *) ); - if (new_buckets == NULL) return 1; + if (new_buckets == NULL) return 1; // LCOV_EXCL_LINE // iterate through the elements and assign them to their new slots for (size_t slot = 0; slot < hash_map->bucket_count; slot++) {