From 4ddfc8b7ddd8c1105fb362129845c2cc7085575b Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Tue, 6 Apr 2021 12:49:15 +0100 Subject: [PATCH] ...and the ctx structure too --- src/lib/server/cond_eval.c | 6 ++--- src/lib/server/map.c | 2 +- src/lib/server/map_async.c | 4 +-- src/lib/server/tmpl.h | 8 +++--- src/lib/server/tmpl_eval.c | 36 +++++++++++++-------------- src/lib/unlang/xlat_builtin.c | 4 +-- src/lib/unlang/xlat_eval.c | 2 +- src/modules/rlm_dhcpv4/rlm_dhcpv4.c | 2 +- src/modules/rlm_expr/rlm_expr.c | 2 +- src/modules/rlm_linelog/rlm_linelog.c | 2 +- src/modules/rlm_smtp/rlm_smtp.c | 6 ++--- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/lib/server/cond_eval.c b/src/lib/server/cond_eval.c index 99cd5ab1cc..e7ad8ab634 100644 --- a/src/lib/server/cond_eval.c +++ b/src/lib/server/cond_eval.c @@ -519,7 +519,7 @@ static int cond_compare_attrs(request_t *request, fr_value_box_t *lhs, map_t con int rcode; fr_pair_t *vp; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_value_box_t *rhs, rhs_cast; fr_dict_attr_t const *da = NULL; @@ -556,7 +556,7 @@ static int cond_compare_virtual(request_t *request, map_t const *map) fr_pair_t *virt, *vp; fr_value_box_t *rhs, rhs_cast; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_assert(tmpl_is_attr(map->lhs)); fr_assert(tmpl_is_attr(map->rhs)); @@ -753,7 +753,7 @@ check_attrs: { fr_pair_t *vp; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_assert(!lhs); diff --git a/src/lib/server/map.c b/src/lib/server/map.c index cd7a71b111..a58290646d 100644 --- a/src/lib/server/map.c +++ b/src/lib/server/map.c @@ -1152,7 +1152,7 @@ int map_to_request(request_t *request, map_t const *map, radius_map_getvalue_t f tmpl_request_ref_t request_ref; tmpl_pair_list_t list_ref; - tmpl_cursor_ctx_t cc = {}; + tmpl_pair_cursor_ctx_t cc = {}; fr_pair_list_init(&src_list); MAP_VERIFY(map); diff --git a/src/lib/server/map_async.c b/src/lib/server/map_async.c index 2a6b0b1640..3db6732b88 100644 --- a/src/lib/server/map_async.c +++ b/src/lib/server/map_async.c @@ -534,7 +534,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out, case TMPL_TYPE_ATTR: { fr_dcursor_t from; - tmpl_cursor_ctx_t cc_attr; + tmpl_pair_cursor_ctx_t cc_attr; fr_pair_t *vp; fr_value_box_t *n_vb; int err; @@ -959,7 +959,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm) TALLOC_CTX *parent; fr_dcursor_t list; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; memset(&cc, 0, sizeof(cc)); diff --git a/src/lib/server/tmpl.h b/src/lib/server/tmpl.h index ef92316a76..a933c0e143 100644 --- a/src/lib/server/tmpl.h +++ b/src/lib/server/tmpl.h @@ -482,7 +482,7 @@ struct tmpl_s { tmpl_rules_t _CONST rules; }; -typedef struct tmpl_cursor_ctx_s tmpl_cursor_ctx_t; +typedef struct tmpl_cursor_ctx_s tmpl_pair_cursor_ctx_t; typedef struct tmpl_cursor_nested_s tmpl_cursor_nested_t; typedef fr_pair_t *(*tmpl_cursor_eval_t)(fr_dlist_head_t *list_head, fr_pair_t *current, tmpl_cursor_nested_t *ns); @@ -711,7 +711,7 @@ void tmpl_verify(char const *file, int line, tmpl_t const *vpt); @code{.c} static tmpl_t list = tmpl_init_initialiser_list(CURRENT_REQUEST, PAIR_LIST_REQUEST); fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc, + tmpl_pair_cursor_ctx_t cc, fr_pair_t *vp; // Iterate over all pairs in the request list @@ -983,11 +983,11 @@ ssize_t _tmpl_to_atype(TALLOC_CTX *ctx, void *out, fr_type_t dst_type) CC_HINT(nonnull (2, 3, 4)); -fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_cursor_ctx_t *cc, +fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_pair_cursor_ctx_t *cc, fr_dcursor_t *cursor, request_t *request, tmpl_t const *vpt); -void tmpl_pair_cursor_clear(tmpl_cursor_ctx_t *cc); +void tmpl_pair_cursor_clear(tmpl_pair_cursor_ctx_t *cc); int tmpl_copy_pairs(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, tmpl_t const *vpt); diff --git a/src/lib/server/tmpl_eval.c b/src/lib/server/tmpl_eval.c index 51a4bb35aa..bc00055343 100644 --- a/src/lib/server/tmpl_eval.c +++ b/src/lib/server/tmpl_eval.c @@ -833,7 +833,7 @@ static fr_pair_t *_tmpl_cursor_tlv_eval(UNUSED fr_dlist_head_t *list_head, UNUSE } static inline CC_HINT(always_inline) -void _tmpl_cursor_pool_init(tmpl_cursor_ctx_t *cc) +void _tmpl_cursor_pool_init(tmpl_pair_cursor_ctx_t *cc) { if (!cc->pool) MEM(cc->pool = talloc_pool(cc->ctx, sizeof(tmpl_cursor_nested_t) * 5)); } @@ -842,7 +842,7 @@ void _tmpl_cursor_pool_init(tmpl_cursor_ctx_t *cc) * */ static inline CC_HINT(always_inline) -void _tmpl_cursor_tlv_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc) +void _tmpl_cursor_tlv_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_pair_cursor_ctx_t *cc) { tmpl_attr_t *prev = fr_dlist_prev(&cc->vpt->data.attribute.ar, ar); @@ -936,7 +936,7 @@ static fr_pair_t *_tmpl_cursor_group_eval(UNUSED fr_dlist_head_t *list_head, UNU * */ static inline CC_HINT(always_inline) -void _tmpl_cursor_group_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc) +void _tmpl_cursor_group_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_pair_cursor_ctx_t *cc) { tmpl_cursor_nested_t *ns; @@ -976,7 +976,7 @@ static fr_pair_t *_tmpl_cursor_leaf_eval(fr_dlist_head_t *list_head, fr_pair_t * * */ static inline CC_HINT(always_inline) -void _tmpl_cursor_leaf_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc) +void _tmpl_cursor_leaf_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_pair_cursor_ctx_t *cc) { tmpl_cursor_nested_t *ns = &cc->leaf; @@ -998,7 +998,7 @@ static fr_pair_t *_tmpl_cursor_list_eval(UNUSED fr_dlist_head_t *list_head, fr_p } static inline CC_HINT(always_inline) -void _tmpl_cursor_list_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc) +void _tmpl_cursor_list_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_pair_cursor_ctx_t *cc) { tmpl_cursor_nested_t *ns; @@ -1012,7 +1012,7 @@ void _tmpl_cursor_list_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_att fr_dlist_insert_tail(&cc->nested, ns); } -static inline CC_HINT(always_inline) void _tmpl_cursor_eval_pop(tmpl_cursor_ctx_t *cc) +static inline CC_HINT(always_inline) void _tmpl_cursor_eval_pop(tmpl_pair_cursor_ctx_t *cc) { tmpl_cursor_nested_t *ns = fr_dlist_pop_tail(&cc->nested); @@ -1030,7 +1030,7 @@ static inline CC_HINT(always_inline) void _tmpl_cursor_eval_pop(tmpl_cursor_ctx_ * @return the vp evaluated. */ static inline CC_HINT(always_inline) -fr_pair_t *_tmpl_cursor_eval(fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_cursor_ctx_t *cc) +fr_pair_t *_tmpl_cursor_eval(fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_pair_cursor_ctx_t *cc) { tmpl_attr_t const *ar; tmpl_cursor_nested_t *ns; @@ -1097,7 +1097,7 @@ fr_pair_t *_tmpl_cursor_eval(fr_dlist_head_t *list_head, fr_pair_t *curr, tmpl_c } static inline CC_HINT(always_inline) -void _tmpl_pair_cursor_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc) +void _tmpl_pair_cursor_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_pair_cursor_ctx_t *cc) { if (fr_dlist_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) { case FR_TYPE_TLV: @@ -1120,7 +1120,7 @@ void _tmpl_pair_cursor_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_att static void *_tmpl_cursor_next(fr_dlist_head_t *list, void *curr, void *uctx) { - tmpl_cursor_ctx_t *cc = uctx; + tmpl_pair_cursor_ctx_t *cc = uctx; tmpl_t const *vpt = cc->vpt; fr_pair_t *vp; @@ -1205,7 +1205,7 @@ static void *_tmpl_cursor_next(fr_dlist_head_t *list, void *curr, void *uctx) * * @see tmpl_cursor_next */ -fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_cursor_ctx_t *cc, +fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_pair_cursor_ctx_t *cc, fr_dcursor_t *cursor, request_t *request, tmpl_t const *vpt) { fr_pair_t *vp = NULL; @@ -1252,7 +1252,7 @@ fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_cursor_ctx_t *c /* * Initialise the temporary cursor context */ - *cc = (tmpl_cursor_ctx_t){ + *cc = (tmpl_pair_cursor_ctx_t){ .vpt = vpt, .ctx = ctx, .request = request, @@ -1299,7 +1299,7 @@ fr_pair_t *tmpl_pair_cursor_init(int *err, TALLOC_CTX *ctx, tmpl_cursor_ctx_t *c /** Clear any temporary state allocations * */ -void tmpl_pair_cursor_clear(tmpl_cursor_ctx_t *cc) +void tmpl_pair_cursor_clear(tmpl_pair_cursor_ctx_t *cc) { if (!fr_dlist_num_elements(&cc->nested)) return;/* Help simplify dealing with unused cursor ctxs */ @@ -1332,7 +1332,7 @@ int tmpl_copy_pairs(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, tm { fr_pair_t *vp; fr_dcursor_t from; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; TMPL_VERIFY(vpt); @@ -1377,7 +1377,7 @@ int tmpl_copy_pair_children(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *req { fr_pair_t *vp; fr_dcursor_t from; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; TMPL_VERIFY(vpt); @@ -1426,7 +1426,7 @@ done: int tmpl_find_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt) { fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_pair_t *vp; int err; @@ -1455,7 +1455,7 @@ int tmpl_find_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt) int tmpl_find_or_add_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt) { fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_pair_t *vp; int err; @@ -1526,7 +1526,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, TALLOC_CTX *list_ctx = NULL; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; tmpl_cursor_nested_t *ns = NULL; tmpl_request_t *rr = NULL; @@ -1600,7 +1600,7 @@ int tmpl_extents_find(TALLOC_CTX *ctx, /* * Initialise the temporary cursor context */ - cc = (tmpl_cursor_ctx_t){ + cc = (tmpl_pair_cursor_ctx_t){ .vpt = vpt, .ctx = ctx, .request = request, diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index a0328149a9..291b7770f0 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -844,7 +844,7 @@ static xlat_action_t xlat_func_debug_attr(UNUSED TALLOC_CTX *ctx, UNUSED fr_dcur { fr_pair_t *vp; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; tmpl_t *vpt; fr_value_box_t *attr = fr_dlist_head(in); char const *fmt; @@ -2074,7 +2074,7 @@ static xlat_action_t xlat_func_pairs(TALLOC_CTX *ctx, fr_dcursor_t *out, { tmpl_t *vpt = NULL; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_value_box_t *vb; fr_value_box_t *in_head = fr_dlist_head(in); diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index f3aaef6fe7..23fe840596 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -814,7 +814,7 @@ static xlat_action_t xlat_eval_pair_real(TALLOC_CTX *ctx, fr_dcursor_t *out, req fr_value_box_t *value; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; xlat_action_t ret = XLAT_ACTION_DONE; diff --git a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c index 5b254af01f..7fb752c3c6 100644 --- a/src/modules/rlm_dhcpv4/rlm_dhcpv4.c +++ b/src/modules/rlm_dhcpv4/rlm_dhcpv4.c @@ -154,7 +154,7 @@ static xlat_action_t dhcpv4_encode_xlat(TALLOC_CTX *ctx, fr_dcursor_t *out, tmpl_t *vpt; fr_pair_t *vp; fr_dcursor_t *cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; bool tainted = false; fr_value_box_t *encoded; diff --git a/src/modules/rlm_expr/rlm_expr.c b/src/modules/rlm_expr/rlm_expr.c index f25741ee7c..3330d23450 100644 --- a/src/modules/rlm_expr/rlm_expr.c +++ b/src/modules/rlm_expr/rlm_expr.c @@ -219,7 +219,7 @@ static bool get_number(request_t *request, char const **string, int64_t *answer) ssize_t slen; fr_pair_t *vp; fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; slen = tmpl_afrom_attr_substr(request, NULL, &vpt, &FR_SBUFF_IN(p, strlen(p)), diff --git a/src/modules/rlm_linelog/rlm_linelog.c b/src/modules/rlm_linelog/rlm_linelog.c index 59298c674b..53730c0b54 100644 --- a/src/modules/rlm_linelog/rlm_linelog.c +++ b/src/modules/rlm_linelog/rlm_linelog.c @@ -563,7 +563,7 @@ build_vector: { #define VECTOR_INCREMENT 20 fr_dcursor_t cursor; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; fr_pair_t *vp; int alloced = VECTOR_INCREMENT, i; diff --git a/src/modules/rlm_smtp/rlm_smtp.c b/src/modules/rlm_smtp/rlm_smtp.c index f86691bb40..5ae1fbc521 100644 --- a/src/modules/rlm_smtp/rlm_smtp.c +++ b/src/modules/rlm_smtp/rlm_smtp.c @@ -221,7 +221,7 @@ static int tmpl_attr_to_slist(fr_mail_ctx *uctx, struct curl_slist **out, tmpl_t { request_t *request = ((fr_mail_ctx *)uctx)->request; fr_pair_t *vp; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; int count = 0; /* Iterate over the VP and add the string value to the curl_slist */ @@ -269,7 +269,7 @@ static int tmpl_arr_to_slist (rlm_smtp_thread_t *t, fr_mail_ctx *uctx, struct cu static ssize_t tmpl_attr_to_sbuff (fr_mail_ctx *uctx, fr_sbuff_t *out, tmpl_t const *vpt, char const *delimeter) { fr_pair_t *vp; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; ssize_t copied = 0; @@ -379,7 +379,7 @@ static int tmpl_attr_to_attachment (fr_mail_ctx *uctx, curl_mime *mime, const tm { fr_pair_t *vp; request_t *request = uctx->request; - tmpl_cursor_ctx_t cc; + tmpl_pair_cursor_ctx_t cc; int attachments_set = 0; /* Check for any file attachments */ -- 2.47.2