add missing exclusions for some allocation error handling (all remaining uncovered lines must be covered eventually) default tip

Tue, 18 Nov 2025 17:55:49 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 18 Nov 2025 17:55:49 +0100
changeset 1496
1a982f6f2407
parent 1495
beee442be85a

add missing exclusions for some allocation error handling (all remaining uncovered lines must be covered eventually)

src/array_list.c file | annotate | diff | comparison | revisions
--- a/src/array_list.c	Tue Nov 18 17:52:12 2025 +0100
+++ b/src/array_list.c	Tue Nov 18 17:55:49 2025 +0100
@@ -367,10 +367,12 @@
     if (elem_count == 0) return 0;
 
     // overflow check
+    // LCOV_EXCL_START
     if (elem_count > SIZE_MAX - *size) {
         errno = EOVERFLOW;
         return 1;
     }
+    // LCOV_EXCL_STOP
 
     // store some counts
     const size_t old_size = *size;
@@ -792,7 +794,7 @@
                 &arl->data, new_capacity,
                 list->collection.elem_size)
         ) {
-            return 0;
+            return 0; // LCOV_EXCL_LINE
         }
         arl->capacity = new_capacity;
     }
@@ -836,7 +838,7 @@
             &arl->reallocator
     )) {
         // array list implementation is "all or nothing"
-        return 0;
+        return 0;  // LCOV_EXCL_LINE
     } else {
         return n;
     }
@@ -861,7 +863,7 @@
             &arl->reallocator
     )) {
         // array list implementation is "all or nothing"
-        return 0;
+        return 0;  // LCOV_EXCL_LINE
     } else {
         return n;
     }
@@ -888,7 +890,7 @@
     if (iter->index < list->collection.size) {
         if (cx_arl_insert_element(list,
                 iter->index + 1 - prepend, elem) == NULL) {
-            return 1;
+            return 1; // LCOV_EXCL_LINE
         }
         iter->elem_count++;
         if (prepend != 0) {
@@ -898,7 +900,7 @@
         return 0;
     } else {
         if (cx_arl_insert_element(list, list->collection.size, elem) == NULL) {
-            return 1;
+            return 1;  // LCOV_EXCL_LINE
         }
         iter->elem_count++;
         iter->index = list->collection.size;

mercurial