From: Nick Porter Date: Tue, 22 Dec 2020 18:05:12 +0000 (+0000) Subject: Amend fr_proto_next_encodable() to work with fr_dcursor_t X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0185f11e60abf415f60bfe2a33804ffb2975624d;p=thirdparty%2Ffreeradius-server.git Amend fr_proto_next_encodable() to work with fr_dcursor_t --- diff --git a/src/lib/util/proto.c b/src/lib/util/proto.c index 57b0f853454..772968fc396 100644 --- a/src/lib/util/proto.c +++ b/src/lib/util/proto.c @@ -89,9 +89,7 @@ void fr_proto_da_stack_print(char const *file, int line, char const *func, fr_da /** Implements the default iterator to encode pairs belonging to a specific dictionary that are not internal * - * @param[in,out] prev The fr_pair_t before curr. Will be updated to point to the - * pair before the one returned, or the last pair in the list - * if no matching pairs found. + * @param[in] list to itterate over. * @param[in] to_eval The fr_pair_t after cursor->current. Will be checked to * see if it matches the specified fr_dict_t. * @param[in] uctx The fr_dict_t to search for. @@ -99,20 +97,18 @@ void fr_proto_da_stack_print(char const *file, int line, char const *func, fr_da * - Next matching fr_pair_t. * - NULL if not more matching fr_pair_ts could be found. */ -void *fr_proto_next_encodable(void **prev, void *to_eval, void *uctx) +void *fr_proto_next_encodable(fr_dlist_head_t *list, void *to_eval, void *uctx) { - fr_pair_t *c, *p; + fr_pair_t *c; fr_dict_t *dict = talloc_get_type_abort(uctx, fr_dict_t); if (!to_eval) return NULL; - for (p = *prev, c = to_eval; c; p = c, c = c->next) { + for (c = to_eval; c; c = fr_dlist_next(list, c)) { VP_VERIFY(c); if ((c->da->dict == dict) && (!c->da->flags.internal)) break; } - *prev = p; - return c; } diff --git a/src/lib/util/proto.h b/src/lib/util/proto.h index f622e67f037..531a2bf51b4 100644 --- a/src/lib/util/proto.h +++ b/src/lib/util/proto.h @@ -62,7 +62,7 @@ void fr_proto_print_hex_data(char const *file, int line, uint8_t const *data, si void fr_proto_print_hex_marker(char const *file, int line, uint8_t const *data, size_t data_len, ssize_t slen, char const *fmt, ...); -void *fr_proto_next_encodable(void **prev, void *to_eval, void *uctx); +void *fr_proto_next_encodable(fr_dlist_head_t *list, void *to_eval, void *uctx); void fr_proto_da_stack_print(char const *file, int line, char const *func, fr_da_stack_t *da_stack, unsigned int depth);