From: Alan T. DeKok Date: Fri, 5 May 2017 13:38:46 +0000 (-0400) Subject: stupid compiler checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d61e4cd42eac8cb657d5cb9739e56692f1eb042;p=thirdparty%2Ffreeradius-server.git stupid compiler checks --- diff --git a/src/lib/io/time.h b/src/lib/io/time.h index 05431fb785e..7d1d573ef3f 100644 --- a/src/lib/io/time.h +++ b/src/lib/io/time.h @@ -29,6 +29,7 @@ RCSIDH(time_h, "$Id$") * For sys/time.h and time.h */ #include +#include #include #include @@ -84,14 +85,20 @@ typedef struct fr_time_tracking_t { #define FR_DLIST_INIT(head) do { head.prev = head.next = &head; } while (0) static inline void fr_dlist_insert_head(fr_dlist_t *head, fr_dlist_t *entry) { + if (!rad_cond_assert(head->next != NULL)) return; + if (!rad_cond_assert(head->prev != NULL)) return; + entry->prev = head; entry->next = head->next; - if (head->next) head->next->prev = entry; /* Head may be the only node in the list */ + head->next->prev = entry; head->next = entry; } static inline void fr_dlist_insert_tail(fr_dlist_t *head, fr_dlist_t *entry) { + if (!rad_cond_assert(head->next != NULL)) return; + if (!rad_cond_assert(head->prev != NULL)) return; + entry->next = head; entry->prev = head->prev; head->prev->next = entry; @@ -100,6 +107,9 @@ static inline void fr_dlist_insert_tail(fr_dlist_t *head, fr_dlist_t *entry) static inline void fr_dlist_remove(fr_dlist_t *entry) { + if (!rad_cond_assert(entry->next != NULL)) return; + if (!rad_cond_assert(entry->prev != NULL)) return; + entry->prev->next = entry->next; entry->next->prev = entry->prev; entry->prev = entry->next = entry;