From: Alan T. DeKok Date: Wed, 27 Mar 2019 17:09:42 +0000 (-0400) Subject: rename definitions X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73616c6e02a68426ec4bf71aa650da141ac2161f;p=thirdparty%2Ffreeradius-server.git rename definitions so that we have UNLANG_ACTION_EXECUTE_NEXT instead of CONTINUE and other similar changes. We may want to add a "continue" keyword, so it's best to keep CONTINUE reserved for that. --- diff --git a/src/lib/unlang/base.h b/src/lib/unlang/base.h index 4bbdf6f186d..31c4c4143a7 100644 --- a/src/lib/unlang/base.h +++ b/src/lib/unlang/base.h @@ -33,7 +33,7 @@ */ typedef enum { UNLANG_ACTION_CALCULATE_RESULT = 1, //!< Calculate a new section #rlm_rcode_t value. - UNLANG_ACTION_CONTINUE, //!< Execute the next #unlang_t. + UNLANG_ACTION_EXECUTE_NEXT, //!< Execute the next #unlang_t. UNLANG_ACTION_PUSHED_CHILD, //!< #unlang_t pushed a new child onto the stack, //!< execute it instead of continuing. UNLANG_ACTION_BREAK, //!< Break out of the current group. diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 38e71c00bf9..584a4b9aa44 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -34,7 +34,7 @@ RCSID("$Id$") static FR_NAME_NUMBER unlang_action_table[] = { { "calculate-result", UNLANG_ACTION_CALCULATE_RESULT }, - { "continue", UNLANG_ACTION_CONTINUE }, + { "next", UNLANG_ACTION_EXECUTE_NEXT }, { "pushed-child", UNLANG_ACTION_PUSHED_CHILD }, { "break", UNLANG_ACTION_BREAK }, { "yield", UNLANG_ACTION_YIELD }, @@ -170,7 +170,7 @@ void unlang_push(unlang_stack_t *stack, unlang_t *program, rlm_rcode_t result, b #ifndef NDEBUG if (DEBUG_ENABLED5) DEBUG("unlang_push called with instruction %s - args %s %s", program ? program->debug_name : "", - do_next_sibling ? "UNLANG_NEXT_CONTINUE" : "UNLANG_NEXT_STOP", + do_next_sibling ? "UNLANG_NEXT_SUBLING" : "UNLANG_NEXT_STOP", top_frame ? "UNLANG_TOP_FRAME" : "UNLANG_SUB_FRAME"); #endif @@ -231,7 +231,7 @@ static inline void unlang_pop(unlang_stack_t *stack) * @param[in,out] result The current section result. * @param[in,out] priority The current section priority. * @return - * - UNLANG_FRAME_ACTION_CONTINUE evaluate more instructions. + * - UNLANG_FRAME_ACTION_NEXT evaluate more instructions. * - UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame. */ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, unlang_stack_frame_t *frame, @@ -250,7 +250,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un /* * Don't set action or priority if we don't have one. */ - if (*result == RLM_MODULE_UNKNOWN) return UNLANG_FRAME_ACTION_CONTINUE; + if (*result == RLM_MODULE_UNKNOWN) return UNLANG_FRAME_ACTION_NEXT; /* * The child's action says return. Do so. @@ -322,7 +322,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un return UNLANG_FRAME_ACTION_POP; } - return frame->next ? UNLANG_FRAME_ACTION_CONTINUE : UNLANG_FRAME_ACTION_POP; + return frame->next ? UNLANG_FRAME_ACTION_NEXT : UNLANG_FRAME_ACTION_POP; } /** Evaluates all the unlang nodes in a section @@ -332,7 +332,7 @@ static inline unlang_frame_action_t unlang_calculate_result(REQUEST *request, un * @param[in,out] result The current section result. * @param[in,out] priority The current section priority. * @return - * - UNLANG_FRAME_ACTION_CONTINUE evaluate more instructions in the current stack frame + * - UNLANG_FRAME_ACTION_NEXT evaluate more instructions in the current stack frame * which may not be the same frame as when this function * was called. * - UNLANG_FRAME_ACTION_POP the final result has been calculated for this frame. @@ -410,7 +410,7 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s case UNLANG_ACTION_PUSHED_CHILD: rad_assert(&stack->frame[stack->depth] > frame); *result = frame->result; - return UNLANG_FRAME_ACTION_CONTINUE; + return UNLANG_FRAME_ACTION_NEXT; /* * We're in a looping construct and need to stop @@ -493,8 +493,8 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s /* * Execute the next instruction in this frame */ - case UNLANG_ACTION_CONTINUE: - if ((action == UNLANG_ACTION_CONTINUE) && unlang_ops[instruction->type].debug_braces) { + case UNLANG_ACTION_EXECUTE_NEXT: + if ((action == UNLANG_ACTION_EXECUTE_NEXT) && unlang_ops[instruction->type].debug_braces) { REXDENT(); RDEBUG2("}"); } @@ -519,7 +519,7 @@ static inline unlang_frame_action_t unlang_frame_eval(REQUEST *request, unlang_s rlm_rcode_t unlang_run(REQUEST *request) { int priority; - unlang_frame_action_t fa = UNLANG_FRAME_ACTION_CONTINUE; + unlang_frame_action_t fa = UNLANG_FRAME_ACTION_NEXT; /* * We don't have a return code yet. @@ -538,7 +538,7 @@ rlm_rcode_t unlang_run(REQUEST *request) for (;;) { switch (fa) { - case UNLANG_FRAME_ACTION_CONTINUE: /* Evaluate the current frame */ + case UNLANG_FRAME_ACTION_NEXT: /* Evaluate the current frame */ priority = -1; rad_assert(stack->depth > 0); @@ -578,7 +578,7 @@ rlm_rcode_t unlang_run(REQUEST *request) * back on up the stack. */ if (frame->repeat) { - fa = UNLANG_FRAME_ACTION_CONTINUE; + fa = UNLANG_FRAME_ACTION_NEXT; continue; } @@ -612,7 +612,7 @@ rlm_rcode_t unlang_run(REQUEST *request) * then we advance the instruction else we * end up executing the same code over and over... */ - if (fa == UNLANG_FRAME_ACTION_CONTINUE) { + if (fa == UNLANG_FRAME_ACTION_NEXT) { RDEBUG4("** [%i] %s - continuing after subsection with (%s %d)", stack->depth, __FUNCTION__, fr_int2str(mod_rcode_table, stack->result, ""), @@ -725,7 +725,7 @@ void unlang_push_section(REQUEST *request, CONF_SECTION *cs, rlm_rcode_t action, * no action. */ if (top_frame) unlang_push(stack, NULL, action, UNLANG_NEXT_STOP, UNLANG_TOP_FRAME); - if (instruction) unlang_push(stack, instruction, RLM_MODULE_UNKNOWN, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME); + if (instruction) unlang_push(stack, instruction, RLM_MODULE_UNKNOWN, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME); RDEBUG4("** [%i] %s - substack begins", stack->depth, __FUNCTION__); diff --git a/src/lib/unlang/op.c b/src/lib/unlang/op.c index 7f3dd7a760c..580e7724ab5 100644 --- a/src/lib/unlang/op.c +++ b/src/lib/unlang/op.c @@ -440,10 +440,10 @@ static unlang_action_t unlang_group(REQUEST *request, */ if (!g->children) { RDEBUG2("} # %s ... ", instruction->debug_name); - return UNLANG_ACTION_CONTINUE; + return UNLANG_ACTION_EXECUTE_NEXT; } - unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME); + unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME); return UNLANG_ACTION_PUSHED_CHILD; } @@ -764,7 +764,7 @@ static unlang_action_t unlang_call(REQUEST *request, /* * And then call the children to process the answer. */ - unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME); + unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME); return UNLANG_ACTION_PUSHED_CHILD; } @@ -785,7 +785,7 @@ static unlang_action_t unlang_subrequest(REQUEST *request, /* * Allocate the child request. */ - child = unlang_child_alloc(request, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_DETACHABLE); + child = unlang_child_alloc(request, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_DETACHABLE); if (!child) { *presult = RLM_MODULE_FAIL; *priority = instruction->actions[*presult]; @@ -1407,7 +1407,7 @@ static unlang_action_t unlang_foreach(REQUEST *request, /* * Push the child, and yield for a later return. */ - unlang_push(stack, g->children, frame->result, UNLANG_NEXT_CONTINUE, UNLANG_SUB_FRAME); + unlang_push(stack, g->children, frame->result, UNLANG_NEXT_SIBLING, UNLANG_SUB_FRAME); frame->repeat = true; return UNLANG_ACTION_PUSHED_CHILD; @@ -1550,7 +1550,7 @@ do_null_case: * Nothing found. Just continue, and ignore the "switch" * statement. */ - if (!found) return UNLANG_ACTION_CONTINUE; + if (!found) return UNLANG_ACTION_EXECUTE_NEXT; unlang_push(stack, found, frame->result, UNLANG_NEXT_STOP, UNLANG_SUB_FRAME); return UNLANG_ACTION_PUSHED_CHILD; @@ -1592,7 +1592,7 @@ static unlang_action_t unlang_if(REQUEST *request, if (*presult != RLM_MODULE_UNKNOWN) *priority = instruction->actions[*presult]; - return UNLANG_ACTION_CONTINUE; + return UNLANG_ACTION_EXECUTE_NEXT; } /* diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index b58604a8cc5..682bd7eecf2 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -87,7 +87,7 @@ typedef enum { typedef enum { UNLANG_FRAME_ACTION_POP = 1, //!< Pop the current frame, and check the next one further ///< up in the stack for what to do next. - UNLANG_FRAME_ACTION_CONTINUE, //!< Process the next instruction at this level. + UNLANG_FRAME_ACTION_NEXT, //!< Process the next instruction at this level. UNLANG_FRAME_ACTION_YIELD //!< Temporarily return control back to the caller on the C ///< stack. } unlang_frame_action_t; @@ -100,8 +100,8 @@ typedef enum { UNLANG_GROUP_TYPE_MAX //!< Number of group types. } unlang_group_type_t; -#define UNLANG_NEXT_STOP (false) -#define UNLANG_NEXT_CONTINUE (true) +#define UNLANG_NEXT_STOP (false) +#define UNLANG_NEXT_SIBLING (true) #define UNLANG_DETACHABLE (true) #define UNLANG_NORMAL_CHILD (false) @@ -121,7 +121,7 @@ typedef struct unlang_s unlang_t; */ struct unlang_s { unlang_t *parent; //!< Previous node. - unlang_t *next; //!< Next node (executed on #UNLANG_ACTION_CONTINUE et al). + unlang_t *next; //!< Next node (executed on #UNLANG_ACTION_EXECUTE_NEXT et al). char const *name; //!< Unknown... char const *debug_name; //!< Printed in log messages when the node is executed. unlang_type_t type; //!< The specialisation of this node. diff --git a/src/lib/unlang/xlat.c b/src/lib/unlang/xlat.c index f4540c159ad..fb61412719d 100644 --- a/src/lib/unlang/xlat.c +++ b/src/lib/unlang/xlat.c @@ -383,7 +383,7 @@ static unlang_action_t unlang_xlat_inline(REQUEST *request, RDEBUG2("`%s`", mx->xlat_name); radius_exec_program(request, NULL, 0, NULL, request, mx->xlat_name, request->packet->vps, false, true, EXEC_TIMEOUT); - return UNLANG_ACTION_CONTINUE; + return UNLANG_ACTION_EXECUTE_NEXT; } }