From: Alan T. DeKok Date: Tue, 5 Apr 2022 14:04:09 +0000 (-0400) Subject: add fr_pair_list_dlist_head() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5efe7f3638d95a0afe36ba2ab7fe1aa1205e0fa8;p=thirdparty%2Ffreeradius-server.git add fr_pair_list_dlist_head() and use it so that no one looks at internal fields --- diff --git a/src/lib/server/tmpl_dcursor.c b/src/lib/server/tmpl_dcursor.c index fd3cba5840..9a5843831d 100644 --- a/src/lib/server/tmpl_dcursor.c +++ b/src/lib/server/tmpl_dcursor.c @@ -587,7 +587,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, list_ctx = ns->list_ctx; ar = ns->ar; - curr = _tmpl_cursor_eval(&list_head->order.head, curr, &cc); + curr = _tmpl_cursor_eval(fr_pair_list_dlist_head(list_head), curr, &cc); if (!curr) { /* * References extend beyond current diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index ea6ee061ca..b7aebba974 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2808,6 +2808,17 @@ size_t fr_pair_list_len(fr_pair_list_t const *list) return fr_pair_order_list_num_elements(&list->order); } +/** Get the dlist head from a pair list + * + * @param[in] list to get the head from + * + * @return number of entries in the list + */ +fr_dlist_head_t *fr_pair_list_dlist_head(fr_pair_list_t const *list) +{ + return fr_pair_order_list_list_head(&list->order); +} + /** Parse a list of VPs from a value box. * * @param[in] ctx to allocate new VPs in diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index 7c23023fdb..765c2674a4 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -222,6 +222,8 @@ bool fr_pair_list_empty(fr_pair_list_t const *list) CC_HINT(nonnull); size_t fr_pair_list_len(fr_pair_list_t const *list) CC_HINT(nonnull); +fr_dlist_head_t *fr_pair_list_dlist_head(fr_pair_list_t const *list) CC_HINT(nonnull); + /* Searching and list modification */ int fr_pair_to_unknown(fr_pair_t *vp) CC_HINT(nonnull);