From: Alan T. DeKok Date: Thu, 20 Jan 2022 16:34:14 +0000 (-0500) Subject: no need to pass "func" to xlat_purify_expr() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d3a3f9e7b025b5ab32dfc40efbe540992f6e75b;p=thirdparty%2Ffreeradius-server.git no need to pass "func" to xlat_purify_expr() --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index b53ea17848..c90e1e8ffc 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -115,9 +115,10 @@ static void cast_to_bool(fr_value_box_t *out, fr_value_box_t const *in) /** Basic purify, but only for expressions and comparisons. * */ -static int xlat_purify_expr(xlat_exp_t *node, xlat_t *func) +static int xlat_purify_expr(xlat_exp_t *node) { int rcode = -1; + xlat_t const *func; xlat_exp_t *child; fr_value_box_t *dst = NULL, *box; xlat_arg_parser_t const *arg; @@ -125,10 +126,12 @@ static int xlat_purify_expr(xlat_exp_t *node, xlat_t *func) fr_value_box_list_t input, output; fr_dcursor_t cursor; - if (!func || (node->type != XLAT_FUNC)) return 0; + if (node->type != XLAT_FUNC) return 0; if (!node->flags.pure) return 0; + func = node->call.func; + if (!func->internal) return 0; if (func->token == T_INVALID) return 0; @@ -948,6 +951,16 @@ done: } check_unary: + /* + * Purify things in place, where we can. + */ + if (flags->pure) { + if (xlat_purify_expr(node) < 0) { + talloc_free(node); + FR_SBUFF_ERROR_RETURN(&in); /* @todo m_lhs ? */ + } + } + /* * @todo - purify the node. */ @@ -1170,7 +1183,7 @@ redo: * Purify things in place, where we can. */ if (flags->pure) { - if (xlat_purify_expr(node, func) < 0) { + if (xlat_purify_expr(node) < 0) { talloc_free(node); FR_SBUFF_ERROR_RETURN(&in); /* @todo m_lhs ? */ }