]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move funtion to the only place which uses it
authorAlan T. DeKok <aland@freeradius.org>
Sun, 1 Oct 2023 17:34:07 +0000 (13:34 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 1 Oct 2023 17:34:07 +0000 (13:34 -0400)
src/lib/unlang/xlat.h
src/lib/unlang/xlat_redundant.c
src/lib/unlang/xlat_tokenize.c

index 40fbb4d8f2bd88653015ff87d55f453b5a5facf1..573285fb91361a3f8c96ca9738f699da80e3a0b6 100644 (file)
@@ -436,8 +436,6 @@ void                xlat_debug_attr_vp(request_t *request, fr_pair_t *vp, tmpl_t const *vpt);
 /*
  *     xlat_tokenize.c
  */
-xlat_exp_t     *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_head_t const *args);
-
 tmpl_t         *xlat_to_tmpl_attr(TALLOC_CTX *ctx, xlat_exp_head_t *xlat);
 
 int            xlat_from_tmpl_attr(TALLOC_CTX *ctx, xlat_exp_head_t **head, tmpl_t **vpt_p);
index 28c2bb835353e07855305275635da9b8150dbff1..de270b03e2047f925cdd203f7f365f8c7c3f9327 100644 (file)
@@ -186,6 +186,35 @@ static xlat_action_t xlat_redundant(TALLOC_CTX *ctx, fr_dcursor_t *out,
        return XLAT_ACTION_PUSH_UNLANG;
 }
 
+/** Allocate an xlat node to call an xlat function
+ *
+ * @param[in] ctx      to allocate the new node in.
+ * @param[in] func     to call.
+ * @param[in] args     Arguments to the function.  Will be copied,
+ *                     and freed when the new xlat node is freed.
+ */
+static xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_head_t const *args)
+{
+       xlat_exp_t *node;
+
+       MEM(node = xlat_exp_alloc(ctx, XLAT_FUNC, func->name, strlen(func->name)));
+       node->call.func = func;
+       if (unlikely(xlat_copy(node, node->call.args, args) < 0)) {
+               talloc_free(node);
+               return NULL;
+       }
+       node->flags = func->flags;
+       xlat_flags_merge(&node->flags, &args->flags);
+
+       /*
+        *      If the function is pure, AND it's arguments are pure,
+        *      then remember that we need to call a pure function.
+        */
+       node->flags.can_purify = (func->flags.pure && args->flags.pure) | args->flags.can_purify;
+
+       return node;
+}
+
 
 /** Allocate additional nodes for evaluation
  *
index 0e6a399ea64790b378ee52e1abc2718f447cee1b..2e6cc0cf9ec00ba8ac725e9c94628defb45bbe74 100644 (file)
@@ -115,35 +115,6 @@ static fr_sbuff_parse_rules_t const xlat_new_arg_rules = {
                ),
 };
 
-/** Allocate an xlat node to call an xlat function
- *
- * @param[in] ctx      to allocate the new node in.
- * @param[in] func     to call.
- * @param[in] args     Arguments to the function.  Will be copied,
- *                     and freed when the new xlat node is freed.
- */
-xlat_exp_t *xlat_exp_func_alloc(TALLOC_CTX *ctx, xlat_t *func, xlat_exp_head_t const *args)
-{
-       xlat_exp_t *node;
-
-       MEM(node = xlat_exp_alloc(ctx, XLAT_FUNC, func->name, strlen(func->name)));
-       node->call.func = func;
-       if (unlikely(xlat_copy(node, node->call.args, args) < 0)) {
-               talloc_free(node);
-               return NULL;
-       }
-       node->flags = func->flags;
-       xlat_flags_merge(&node->flags, &args->flags);
-
-       /*
-        *      If the function is pure, AND it's arguments are pure,
-        *      then remember that we need to call a pure function.
-        */
-       node->flags.can_purify = (func->flags.pure && args->flags.pure) | args->flags.can_purify;
-
-       return node;
-}
-
 static int xlat_tokenize_input(xlat_exp_head_t *head, fr_sbuff_t *in,
                                fr_sbuff_parse_rules_t const *p_rules, tmpl_rules_t const *t_rules);