]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't pass NULL to insert after/before
authorAlan T. DeKok <aland@freeradius.org>
Mon, 16 Aug 2021 19:37:48 +0000 (15:37 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 16 Aug 2021 19:37:48 +0000 (15:37 -0400)
the caller should instead use insert head/tail

src/lib/util/dlist.h

index 14fd671a22995673390ead6cb1e65dfbe0710c71..b967f20a23fe7a7a3e4b7b15176ea1b608fcb7d7 100644 (file)
@@ -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;