From 8aea6a054933cb60fbcaf026895da2e3e5025324 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Mon, 14 Jul 2025 16:54:57 -0400 Subject: [PATCH] use macro to initialize struct with UNLANG_RESULT_NOT_SET --- src/lib/unlang/interpret.c | 6 ++---- src/lib/unlang/unlang_priv.h | 3 +-- src/lib/unlang/xlat.c | 2 +- src/lib/unlang/xlat_eval.c | 2 +- src/lib/unlang/xlat_purify.c | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index b8e581304e..d6b39f7dc4 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1246,10 +1246,8 @@ void *unlang_interpret_stack_alloc(TALLOC_CTX *ctx) */ MEM(stack = talloc_zero_pooled_object(ctx, unlang_stack_t, UNLANG_STACK_MAX, 128)); /* 128 bytes per state */ stack->frame[0].result_p = &stack->frame[0].section_result; - stack->frame[0].scratch_result.rcode = RLM_MODULE_NOT_SET; - stack->frame[0].scratch_result.priority = MOD_ACTION_NOT_SET; - stack->frame[0].section_result.rcode = RLM_MODULE_NOT_SET; - stack->frame[0].section_result.priority = MOD_ACTION_NOT_SET; + stack->frame[0].scratch_result = UNLANG_RESULT_NOT_SET; + stack->frame[0].section_result = UNLANG_RESULT_NOT_SET; stack->frame[0].instruction = &unlang_instruction; /* The top frame has no instruction, so we use a dummy one */ return stack; diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 8e6c8123b8..fff7cbae51 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -634,8 +634,7 @@ static inline void frame_state_init(unlang_stack_t *stack, unlang_stack_frame_t /* * Reset for each instruction */ - frame->scratch_result.rcode = RLM_MODULE_NOT_SET; - frame->scratch_result.priority = MOD_ACTION_NOT_SET; + frame->scratch_result = UNLANG_RESULT_NOT_SET; frame->process = op->interpret; frame->signal = op->signal; diff --git a/src/lib/unlang/xlat.c b/src/lib/unlang/xlat.c index defa3b2bcf..e8f2e7ae04 100644 --- a/src/lib/unlang/xlat.c +++ b/src/lib/unlang/xlat.c @@ -728,7 +728,7 @@ xlat_action_t unlang_xlat_yield_to_retry(request_t *request, xlat_func_t resume, */ int unlang_xlat_eval(TALLOC_CTX *ctx, fr_value_box_list_t *out, request_t *request, xlat_exp_head_t const *xlat) { - unlang_result_t result = { .rcode = RLM_MODULE_NOT_SET, .priority = MOD_ACTION_NOT_SET }; + unlang_result_t result = UNLANG_RESULT_NOT_SET; if (xlat->flags.impure_func) { fr_strerror_const("Expansion requires async operations"); diff --git a/src/lib/unlang/xlat_eval.c b/src/lib/unlang/xlat_eval.c index fa7935403e..1231ad1b11 100644 --- a/src/lib/unlang/xlat_eval.c +++ b/src/lib/unlang/xlat_eval.c @@ -1629,7 +1629,7 @@ static ssize_t xlat_eval_sync(TALLOC_CTX *ctx, char **out, request_t *request, x xlat_escape_legacy_t escape, void const *escape_ctx) { fr_value_box_list_t result; - unlang_result_t unlang_result = { .rcode = RLM_MODULE_NOT_SET, .priority = MOD_ACTION_NOT_SET }; + unlang_result_t unlang_result = UNLANG_RESULT_NOT_SET; TALLOC_CTX *pool = talloc_new(NULL); rlm_rcode_t rcode; char *str; diff --git a/src/lib/unlang/xlat_purify.c b/src/lib/unlang/xlat_purify.c index 58db33a9fb..b3db159276 100644 --- a/src/lib/unlang/xlat_purify.c +++ b/src/lib/unlang/xlat_purify.c @@ -66,7 +66,7 @@ int xlat_purify_list(xlat_exp_head_t *head, request_t *request) static int xlat_purify_list_internal(xlat_exp_head_t *head, request_t *request, fr_token_t quote) { int rcode; - unlang_result_t result = { .rcode = RLM_MODULE_NOT_SET, .priority = MOD_ACTION_NOT_SET }; + unlang_result_t result = UNLANG_RESULT_NOT_SET; fr_value_box_list_t list; xlat_flags_t our_flags; xlat_exp_t *node, *next; -- 2.47.2