talloc_free(fr_dlist_pop_head(list_head));
}
+/** Free the item specified
+ *
+ * @param[in] list_head to free item in.
+ * @param[in] ptr to remove and free.
+ * @return
+ * - NULL if no more items in the list.
+ * - Previous item in the list
+ */
+static inline void *fr_dlist_talloc_free_item(fr_dlist_head_t *list_head, void *ptr)
+{
+ void *prev;
+ prev = fr_dlist_remove(list_head, ptr);
+ talloc_free(ptr);
+ return prev;
+}
+
/** Free all items in a doubly linked list (with talloc)
*
* @param[in] head of list to free.
fr_dlist_talloc_free(&list->head);
}
+/** Free a given item in a pair list
+ *
+ * @param[in] list to remove and free item from.
+ * @param[in] vp to free.
+ * @return The vp before the freed item.
+ */
+fr_pair_t *fr_pair_list_free_item(fr_pair_list_t *list, fr_pair_t *vp)
+{
+ return fr_dlist_talloc_free_item(&list->head, vp);
+}
+
/** Is a valuepair list empty
*
* @param[in] list to check
/** @hidecallergraph */
void fr_pair_list_free(fr_pair_list_t *list);
+/** @hidecallergraph */
+fr_pair_t *fr_pair_list_free_item(fr_pair_list_t *list, fr_pair_t *vp);
+
/** @hidecallergraph */
bool fr_pair_list_empty(fr_pair_list_t const *list) CC_HINT(nonnull);