From 63008af30ff35f3c1780e78fa9ac3de7016d2f0b Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 5 Apr 2023 00:38:32 +0200 Subject: [PATCH] Add assertions --- m-list.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/m-list.h b/m-list.h index 4fa61775..7bb68412 100644 --- a/m-list.h +++ b/m-list.h @@ -613,6 +613,8 @@ M_ASSERT (M_C(name, _sublist_p)(olist, opos)); \ /* Remove the item 'opos' from the list 'olist' */ \ struct M_C(name, _s) *current = opos->current; \ + /* current shall reference a valid element of the list */ \ + M_ASSERT (current != NULL); \ struct M_C(name, _s) *next = current->next; \ if (opos->previous == NULL) { \ *olist = next; \ @@ -1432,6 +1434,8 @@ M_ASSERT (npos != NULL && opos != NULL); \ /* First remove the item 'opos' from the list 'olist' */ \ struct M_C(name, _s) *current = opos->current; \ + /* It shall refer a valid argument in the list */ \ + M_ASSERT(current != NULL); \ struct M_C(name, _s) *next = current->next; \ if (opos->previous == NULL) { \ olist->back = next; \