Remove asserts from utlist.h

This commit is contained in:
Rodrigo Arias 2021-12-09 16:55:42 +01:00
parent df968eb4d0
commit f705d707b6

View File

@ -26,8 +26,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define UTLIST_VERSION 2.3.0 #define UTLIST_VERSION 2.3.0
#include <assert.h>
/* /*
* This file contains macros to manipulate singly and doubly-linked lists. * This file contains macros to manipulate singly and doubly-linked lists.
* *
@ -445,9 +443,6 @@ do {
#define LL_REPLACE_ELEM2(head, el, add, next) \ #define LL_REPLACE_ELEM2(head, el, add, next) \
do { \ do { \
LDECLTYPE(head) _tmp; \ LDECLTYPE(head) _tmp; \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \ (add)->next = (el)->next; \
if ((head) == (el)) { \ if ((head) == (el)) { \
(head) = (add); \ (head) = (add); \
@ -469,8 +464,6 @@ do {
do { \ do { \
if (el) { \ if (el) { \
LDECLTYPE(head) _tmp; \ LDECLTYPE(head) _tmp; \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \ (add)->next = (el); \
if ((head) == (el)) { \ if ((head) == (el)) { \
(head) = (add); \ (head) = (add); \
@ -494,8 +487,6 @@ do {
#define LL_APPEND_ELEM2(head, el, add, next) \ #define LL_APPEND_ELEM2(head, el, add, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \ (add)->next = (el)->next; \
(el)->next = (add); \ (el)->next = (add); \
} else { \ } else { \
@ -573,9 +564,6 @@ do {
#undef LL_REPLACE_ELEM2 #undef LL_REPLACE_ELEM2
#define LL_REPLACE_ELEM2(head, el, add, next) \ #define LL_REPLACE_ELEM2(head, el, add, next) \
do { \ do { \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
if ((head) == (el)) { \ if ((head) == (el)) { \
(head) = (add); \ (head) = (add); \
} else { \ } else { \
@ -594,8 +582,6 @@ do {
#define LL_PREPEND_ELEM2(head, el, add, next) \ #define LL_PREPEND_ELEM2(head, el, add, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
if ((head) == (el)) { \ if ((head) == (el)) { \
(head) = (add); \ (head) = (add); \
} else { \ } else { \
@ -705,8 +691,6 @@ do {
#define DL_DELETE2(head,del,prev,next) \ #define DL_DELETE2(head,del,prev,next) \
do { \ do { \
assert((head) != NULL); \
assert((del)->prev != NULL); \
if ((del)->prev == (del)) { \ if ((del)->prev == (del)) { \
(head)=NULL; \ (head)=NULL; \
} else if ((del)==(head)) { \ } else if ((del)==(head)) { \
@ -752,9 +736,6 @@ do {
#define DL_REPLACE_ELEM2(head, el, add, prev, next) \ #define DL_REPLACE_ELEM2(head, el, add, prev, next) \
do { \ do { \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
if ((head) == (el)) { \ if ((head) == (el)) { \
(head) = (add); \ (head) = (add); \
(add)->next = (el)->next; \ (add)->next = (el)->next; \
@ -782,8 +763,6 @@ do {
#define DL_PREPEND_ELEM2(head, el, add, prev, next) \ #define DL_PREPEND_ELEM2(head, el, add, prev, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \ (add)->next = (el); \
(add)->prev = (el)->prev; \ (add)->prev = (el)->prev; \
(el)->prev = (add); \ (el)->prev = (add); \
@ -803,8 +782,6 @@ do {
#define DL_APPEND_ELEM2(head, el, add, prev, next) \ #define DL_APPEND_ELEM2(head, el, add, prev, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \ (add)->next = (el)->next; \
(add)->prev = (el); \ (add)->prev = (el); \
(el)->next = (add); \ (el)->next = (add); \
@ -982,9 +959,6 @@ do {
#define CDL_REPLACE_ELEM2(head, el, add, prev, next) \ #define CDL_REPLACE_ELEM2(head, el, add, prev, next) \
do { \ do { \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
if ((el)->next == (el)) { \ if ((el)->next == (el)) { \
(add)->next = (add); \ (add)->next = (add); \
(add)->prev = (add); \ (add)->prev = (add); \
@ -1006,8 +980,6 @@ do {
#define CDL_PREPEND_ELEM2(head, el, add, prev, next) \ #define CDL_PREPEND_ELEM2(head, el, add, prev, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \ (add)->next = (el); \
(add)->prev = (el)->prev; \ (add)->prev = (el)->prev; \
(el)->prev = (add); \ (el)->prev = (add); \
@ -1026,8 +998,6 @@ do {
#define CDL_APPEND_ELEM2(head, el, add, prev, next) \ #define CDL_APPEND_ELEM2(head, el, add, prev, next) \
do { \ do { \
if (el) { \ if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \ (add)->next = (el)->next; \
(add)->prev = (el); \ (add)->prev = (el); \
(el)->next = (add); \ (el)->next = (add); \