]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
No need for guards on fr_dlist_verify
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 16 Mar 2021 17:49:34 +0000 (17:49 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 16 Mar 2021 17:49:43 +0000 (17:49 +0000)
src/lib/unlang/xlat_eval.c
src/lib/util/dlist.h

index bb6478f30896eccc118f5f4d15ff190e0bfcae86..05ec78fd5172032a88696cafadb994df6e3b3660 100644 (file)
@@ -923,9 +923,9 @@ xlat_action_t xlat_frame_eval_resume(TALLOC_CTX *ctx, fr_dcursor_t *out,
         *      to debug problems if they free or change elements
         *      and don't remove them from the list.
         */
-       if (!fr_dlist_empty(result)) { fr_dlist_verify(result); }
+       fr_dlist_verify(result);
        xa = resume(ctx, out, request, exp->call.inst, thread_inst->data, result, rctx);
-       if (!fr_dlist_empty(result)) { fr_dlist_verify(result); }
+       fr_dlist_verify(result);
 
        RDEBUG2("EXPAND %%{%s:...}", exp->call.func->name);
        switch (xa) {
@@ -1049,9 +1049,7 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_dcursor_t *out,
                         */
                        if (RDEBUG_ENABLED2) fr_value_box_list_acopy(NULL, &result_copy, result);
 
-#ifndef TALLOC_GET_TYPE_ABORT_NOOP
-                       if (!fr_dlist_empty(result)) fr_dlist_verify(result);
-#endif
+                       fr_dlist_verify(result);
 
                        xa = xlat_process_args(ctx, result, request, node->call.func->input_type, node->call.func->args);
                        if (xa == XLAT_ACTION_FAIL) {
@@ -1061,10 +1059,8 @@ xlat_action_t xlat_frame_eval_repeat(TALLOC_CTX *ctx, fr_dcursor_t *out,
 
                        xa = node->call.func->func.async(ctx, out, request,
                                                         node->call.inst->data, thread_inst->data, result);
+                       fr_dlist_verify(result);
 
-#ifndef TALLOC_GET_TYPE_ABORT_NOOP
-                       if (!fr_dlist_empty(result)) fr_dlist_verify(result);
-#endif
                        if (RDEBUG_ENABLED2) {
                                xlat_debug_log_expansion(request, *in, &result_copy);
                                fr_dlist_talloc_free(&result_copy);
index e9f744ff33f370a4e38025ea1f158ecfee08376b..966b595dd055cfac410b85dd3b12291cf06ab08a 100644 (file)
@@ -577,6 +577,8 @@ static inline CC_HINT(nonnull) void fr_dlist_verify(fr_dlist_head_t *list_head)
             item = _talloc_get_type_abort(item, list_head->type, __location__);
        }
 }
+#elif !defined(NDEBUG)
+#  define fr_dlist_verify(_head) fr_assert(_head)
 #else
 #  define fr_dlist_verify(_head)
 #endif