From: Alan T. DeKok Date: Mon, 16 Aug 2021 19:37:48 +0000 (-0400) Subject: don't pass NULL to insert after/before X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=320e4d4fd63497a0524ecaa3584eca89d06b6e5f;p=thirdparty%2Ffreeradius-server.git don't pass NULL to insert after/before the caller should instead use insert head/tail --- diff --git a/src/lib/util/dlist.h b/src/lib/util/dlist.h index 14fd671a229..b967f20a23f 100644 --- a/src/lib/util/dlist.h +++ b/src/lib/util/dlist.h @@ -353,11 +353,7 @@ static inline CC_HINT(nonnull) int fr_dlist_insert_after(fr_dlist_head_t *list_h #endif entry = fr_dlist_item_to_entry(list_head->offset, ptr); - if (!pos) { - pos_entry = &(list_head->entry); - } else { - pos_entry = fr_dlist_item_to_entry(list_head->offset, pos); - } + pos_entry = fr_dlist_item_to_entry(list_head->offset, pos); if (!fr_cond_assert(pos_entry->next != NULL)) return -1; if (!fr_cond_assert(pos_entry->prev != NULL)) return -1; @@ -389,11 +385,7 @@ static inline CC_HINT(nonnull) int fr_dlist_insert_before(fr_dlist_head_t *list_ #endif entry = fr_dlist_item_to_entry(list_head->offset, ptr); - if (!pos) { - pos_entry = &(list_head->entry); - } else { - pos_entry = fr_dlist_item_to_entry(list_head->offset, pos); - } + pos_entry = fr_dlist_item_to_entry(list_head->offset, pos); if (!fr_cond_assert(pos_entry->next != NULL)) return -1; if (!fr_cond_assert(pos_entry->prev != NULL)) return -1;