# HG changeset patch # User Mike Becker # Date 1677187466 -3600 # Node ID 4738a90659070514aaf947f354962cb6c06b5a11 # Parent 4a06fd63909ae0bba2472eba3f47ee691d45d8fa add some asserts diff -r 4a06fd63909a -r 4738a9065907 src/array_list.c --- a/src/array_list.c Thu Feb 23 21:42:46 2023 +0100 +++ b/src/array_list.c Thu Feb 23 22:24:26 2023 +0100 @@ -112,6 +112,8 @@ size_t idx1, size_t idx2 ) { + assert(arr != NULL); + // short circuit if (idx1 == idx2) return; @@ -319,6 +321,7 @@ struct cx_list_s const *list, void const *elem ) { + assert(list->cmpfunc != NULL); char *cur = ((cx_array_list const *) list)->data; for (size_t i = 0; i < list->size; i++) { @@ -332,6 +335,7 @@ } static void cx_arl_sort(struct cx_list_s *list) { + assert(list->cmpfunc != NULL); qsort(((cx_array_list *) list)->data, list->size, list->itemsize, @@ -343,6 +347,7 @@ struct cx_list_s const *list, struct cx_list_s const *other ) { + assert(list->cmpfunc != NULL); if (list->size == other->size) { char const *left = ((cx_array_list const *) list)->data; char const *right = ((cx_array_list const *) other)->data;