From: Arran Cudbard-Bell Date: Tue, 16 Mar 2021 17:49:34 +0000 (+0000) Subject: No need for guards on fr_dlist_verify X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b07f45973e00806d801a2ba3304f793582bae14;p=thirdparty%2Ffreeradius-server.git No need for guards on fr_dlist_verify --- diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index bb6478f3089..05ec78fd517 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -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); diff --git a/src/lib/util/dlist.h b/src/lib/util/dlist.h index e9f744ff33f..966b595dd05 100644 --- a/src/lib/util/dlist.h +++ b/src/lib/util/dlist.h @@ -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