]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove needs_async flag
authorAlan T. DeKok <aland@freeradius.org>
Fri, 16 Dec 2022 17:40:48 +0000 (12:40 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 21 Dec 2022 17:49:18 +0000 (12:49 -0500)
as it is no longer used

src/lib/unlang/foreach.c
src/lib/unlang/xlat.h
src/lib/unlang/xlat_builtin.c
src/lib/unlang/xlat_priv.h
src/lib/unlang/xlat_tokenize.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_delay/rlm_delay.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_icmp/rlm_icmp.c
src/modules/rlm_rest/rlm_rest.c
src/modules/rlm_unbound/rlm_unbound.c

index e6d9f467c4f6d7cf1be1659052c22f6900cfec8e..0f9e6c4f864601745c7b4282ce61b14a4a2d8e29 100644 (file)
@@ -233,7 +233,7 @@ void unlang_foreach_init(void)
                xlat_t *x;
 
                x = xlat_register(NULL, xlat_foreach_names[i],
-                                 unlang_foreach_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC);
+                                 unlang_foreach_xlat, FR_TYPE_VOID, 0);
                fr_assert(x);
                x->uctx = &xlat_foreach_inst[i];
                xlat_internal(x);
index 8f44322f9c53defa240a2d270e1106aab86a78b4..ee07321cb34d8b58e4e4c2d809f26b23985ad871 100644 (file)
@@ -108,8 +108,6 @@ typedef struct xlat_s xlat_t;
  */
 typedef struct {
        bool                    needs_resolving;//!< Needs pass2 resolution.
-       bool                    needs_async;    //!< Node and all child nodes are guaranteed to not
-                                               ///< require asynchronous expansion.
        bool                    pure;           //!< has no external side effects, true for BOX, LITERAL, and some functions
        bool                    can_purify;     //!< if the xlat has a pure function with pure arguments.
 
@@ -121,7 +119,6 @@ typedef struct {
  *
  *     We can't set "needs_resolving" here, and async functions can't be pure.
  */
-#define XLAT_FLAG_NEEDS_ASYNC &(xlat_flags_t) { .needs_async = true, }
 #define XLAT_FLAG_PURE &(xlat_flags_t) { .pure = true, }
 
 extern fr_table_num_sorted_t const xlat_action_table[];
index 8e1e5968b8a417116969a5b858e32721a2775b0e..6392185953c6128687e9b90f4c5e1d233dacd585 100644 (file)
@@ -197,11 +197,6 @@ xlat_t *xlat_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx,
                        return NULL;
                }
 
-               if (c->flags.needs_async != flags->needs_async) {
-                       ERROR("%s: Cannot change async capability of %s", __FUNCTION__, name);
-                       return NULL;
-               }
-
                if (c->func != func) {
                        ERROR("%s: Cannot change callback function for %s", __FUNCTION__, name);
                        return NULL;
@@ -239,7 +234,6 @@ xlat_t *xlat_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx,
         *      If the function is async, it can't be pure.  But
         *      non-pure functions don't need to be async.
         */
-       fr_assert(!flags->needs_async || !flags->pure);
        fr_assert(!flags->needs_resolving);
 
        return c;
@@ -419,8 +413,6 @@ int xlat_func_mono(xlat_t *x, xlat_arg_parser_t const *arg)
 }
 
 /** Set global instantiation/detach callbacks
- *
- * All functions registered must be needs_async.
  *
  * @param[in] xlat             to set instantiation callbacks for.
  * @param[in] instantiate      Instantiation function. Called whenever a xlat is
@@ -449,7 +441,7 @@ void _xlat_async_instantiate_set(xlat_t const *xlat,
 
 /** Register an async xlat
  *
- * All functions registered must be needs_async.
+ * All functions registered must be !pure
  *
  * @param[in] xlat                     to set instantiation callbacks for.
  * @param[in] thread_instantiate       Instantiation function. Called for every compiled xlat
index f55c08aa85b7dfb33160d96d703f5c3623e35857..843f64e926fc5968facfbc2ba66c5e87a85391ae 100644 (file)
@@ -179,16 +179,11 @@ typedef struct {
  *
  * For pass2, if either the parent or child is marked up for pass2, then the parent
  * is marked up for pass2.
- *
- * For needs_async, if both the parent and the child are needs_async, the parent is
- * needs_async.
  */
 static inline CC_HINT(nonnull) void xlat_flags_merge(xlat_flags_t *parent, xlat_flags_t const *child)
 {
-       parent->needs_async |= child->needs_async;
        parent->needs_resolving |= child->needs_resolving;
        parent->pure &= child->pure; /* purity can only be removed, never added */
-       parent->pure &= !parent->needs_async; /* things needing async cannot be pure */
        parent->can_purify |= child->can_purify;
        parent->constant &= child->constant;
 }
index 841220e44aa3c4b504c068faf699f7acf55186af..b106deab09c75465e6065a84f9a2925b748a145f 100644 (file)
@@ -253,7 +253,6 @@ static inline int xlat_tokenize_regex(xlat_exp_head_t *head, fr_sbuff_t *in)
 
        node = xlat_exp_alloc(head, XLAT_REGEX, fr_sbuff_current(&m_s), fr_sbuff_behind(&m_s));
        node->regex_index = num;
-       node->flags.needs_async = false;
 
        fr_sbuff_marker_release(&m_s);
        fr_sbuff_next(in);      /* Skip '}' */
@@ -1016,7 +1015,6 @@ static int xlat_tokenize_string(xlat_exp_head_t *head,
                         *      %% is pure.  Everything else is not.
                         */
                        node->flags.pure = (node->fmt[0] == '%');
-                       node->flags.needs_async = false;
 
                        xlat_exp_insert_tail(head, node);
                        continue;
@@ -1069,16 +1067,14 @@ static void _xlat_debug(xlat_exp_head_t const *head, int depth)
 
        fr_assert(head != NULL);
 
-       INFO_INDENT("head flags = { %s %s %s %s }",
+       INFO_INDENT("head flags = { %s %s %s }",
                    head->flags.needs_resolving ? "need_resolving" : "",
-                   head->flags.needs_async ? "need_async" : "",
                    head->flags.pure ? "pure" : "",
                    head->flags.can_purify ? "can_purify" : "");
 
        xlat_exp_foreach(head, node) {
-               INFO_INDENT("[%d] flags = { %s %s %s %s }", i++,
+               INFO_INDENT("[%d] flags = { %s %s %s }", i++,
                            node->flags.needs_resolving ? "need_resolving" : "",
-                           node->flags.needs_async ? "need_async" : "",
                            node->flags.pure ? "pure" : "",
                            node->flags.can_purify ? "can_purify" : "");
 
index 32269cde7553f74a173b957e8eb61c8bdecfe4c9..d7aca03c54ad10bcc8ccdcc459ee1cfcc382a023 100644 (file)
@@ -974,7 +974,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        /*
         *      Register the cache xlat function
         */
-       xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC);
+       xlat = xlat_register_module(inst, mctx, mctx->inst->name, cache_xlat, FR_TYPE_VOID, 0);
        xlat_func_args(xlat, cache_xlat_args);
 
        return 0;
index ea05cfc3b4907727ca5abad1988aa796a0a8be1d..64f0a2876de7c91f1f1e45f39d86dca5f8bc9660 100644 (file)
@@ -265,7 +265,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        rlm_delay_t     *inst = talloc_get_type_abort(mctx->inst->data, rlm_delay_t);
        xlat_t          *xlat;
 
-       xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, XLAT_FLAG_NEEDS_ASYNC);
+       xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_delay, FR_TYPE_TIME_DELTA, 0);
        xlat_func_args(xlat, xlat_delay_args);
        return 0;
 }
index 7020209b854e9282c22886dc432cc7a700242bc5..189e25c90059134f5a9ff3629108c642dcf8f6b1 100644 (file)
@@ -166,7 +166,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        xlat_t          *xlat;
        char const      *p;
 
-       xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC);
+       xlat = xlat_register_module(NULL, mctx, mctx->inst->name, exec_xlat, FR_TYPE_STRING, 0);
        xlat_func_args(xlat, exec_xlat_args);
 
        if (inst->input) {
index bcfe7d6ecdf15f73ec8954eb3756adf11642381b..7bca945df2af0e1917d066b89459b29158a26b34 100644 (file)
@@ -497,7 +497,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        rlm_icmp_t      *inst = talloc_get_type_abort(mctx->inst->data, rlm_icmp_t);
        xlat_t          *xlat;
 
-       xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, XLAT_FLAG_NEEDS_ASYNC);
+       xlat = xlat_register_module(inst, mctx, mctx->inst->name, xlat_icmp, FR_TYPE_BOOL, 0);
        xlat_func_args(xlat, xlat_icmp_args);
 
        FR_TIME_DELTA_BOUND_CHECK("timeout", inst->timeout, >=, fr_time_delta_from_msec(100)); /* 1/10s minimum timeout */
index dba74b23aace1502248d63b275d971b345e8fe0f..e9d3b857b90861c95be687470f42771b6827ad3a 100644 (file)
@@ -1200,7 +1200,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
        rlm_rest_t      *inst = talloc_get_type_abort(mctx->inst->data, rlm_rest_t);
        xlat_t          *xlat;
 
-       xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, XLAT_FLAG_NEEDS_ASYNC);
+       xlat = xlat_register_module(inst, mctx, mctx->inst->name, rest_xlat, FR_TYPE_STRING, 0);
        xlat_func_args(xlat, rest_xlat_args);
 
        return 0;
index d09309f898aa4132a87fb3457d3b9a4421ce6551..c6880ee080e359cc4537d4914b54e442cb1411f5 100644 (file)
@@ -490,7 +490,7 @@ static int mod_bootstrap(module_inst_ctx_t const *mctx)
                return -1;
        }
 
-       if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, XLAT_FLAG_NEEDS_ASYNC))) return -1;
+       if(!(xlat = xlat_register_module(NULL, mctx, mctx->inst->name, xlat_unbound, FR_TYPE_VOID, 0))) return -1;
        xlat_func_args(xlat, xlat_unbound_args);
 
        return 0;