From: Arran Cudbard-Bell Date: Tue, 29 Apr 2025 23:04:12 +0000 (-0400) Subject: s/UNWIND_FLAG/UNWIND_FRAME_FLAG/g X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aff50d1441fa3629f1611939668e6908c28a2a56;p=thirdparty%2Ffreeradius-server.git s/UNWIND_FLAG/UNWIND_FRAME_FLAG/g --- diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index ecfbe774d0..ec70a8e9f4 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -106,20 +106,20 @@ static char *stack_unwind_flag_dump(uint8_t unwind) static __thread char buf[256]; size_t len; -#define UNWIND_FLAG_DUMP(attrib) \ +#define UNWIND_FRAME_FLAG_DUMP(attrib) \ if (unwind & attrib) strcat(buf, #attrib" ") snprintf(buf, sizeof(buf), "unwind=0x%x (", unwind); - UNWIND_FLAG_DUMP(UNWIND_FLAG_TOP_FRAME); - UNWIND_FLAG_DUMP(UNWIND_FLAG_BREAK_POINT); - UNWIND_FLAG_DUMP(UNWIND_FLAG_RETURN_POINT); + UNWIND_FRAME_FLAG_DUMP(UNWIND_FRAME_FLAG_TOP_FRAME); + UNWIND_FRAME_FLAG_DUMP(UNWIND_FRAME_FLAG_BREAK_POINT); + UNWIND_FRAME_FLAG_DUMP(UNWIND_FRAME_FLAG_RETURN_POINT); len = strlen(buf); if (buf[len - 1] == ' ') buf[len - 1] = '\0'; /* Trim trailing space */ strcat(buf, ")"); -#undef UNWIND_FLAG_DUMP +#undef UNWIND_FRAME_FLAG_DUMP return buf; } @@ -197,7 +197,7 @@ int unlang_interpret_push(request_t *request, unlang_t const *instruction, } /* else frame->next MUST be NULL */ - frame->uflags = UNWIND_FLAG_NONE; + frame->uflags = UNWIND_FRAME_FLAG_NONE; if (top_frame) top_frame_set(frame); frame->result = default_rcode; @@ -487,7 +487,7 @@ finalize: /* * Not allowed in frame uflags... */ - fr_assert(!(frame->uflags & UNWIND_FLAG_NO_CLEAR)); + fr_assert(!(frame->uflags & UNWIND_FRAME_FLAG_NO_CLEAR)); /* * If we are unwinding the stack due to a break / return, @@ -497,7 +497,7 @@ finalize: /* * Continue unwinding... */ - if (!(stack->unwind & frame->uflags) || (stack->unwind & UNWIND_FLAG_NO_CLEAR)) { + if (!(stack->unwind & frame->uflags) || (stack->unwind & UNWIND_FRAME_FLAG_NO_CLEAR)) { RDEBUG4("** [%i] %s - unwinding current frame with (%s %d) - flags - stack (%i), frame (%i)", stack->depth, __FUNCTION__, fr_table_str_by_value(mod_rcode_table, frame->result, ""), @@ -512,7 +512,7 @@ finalize: * and the "NO_CLEAR" flag hasn't been set, then * clear the unwind field so we stop unwinding. */ - stack->unwind = UNWIND_FLAG_NONE; + stack->unwind = UNWIND_FRAME_FLAG_NONE; RDEBUG4("** [%i] %s - unwind stop (%s %d) - flags - stack unwind (%i), frame uflags (%i)", stack->depth, __FUNCTION__, @@ -679,7 +679,7 @@ unlang_frame_action_t frame_eval(request_t *request, unlang_stack_frame_t *frame frame->result = *result; frame->priority = *priority; frame->next = NULL; - fr_assert(stack->unwind != UNWIND_FLAG_NONE); + fr_assert(stack->unwind != UNWIND_FRAME_FLAG_NONE); return UNLANG_FRAME_ACTION_POP; /* diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index 58278b3e2a..01e9f4c0eb 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -336,57 +336,57 @@ extern unlang_op_t unlang_ops[]; extern fr_table_num_sorted_t const mod_rcode_table[]; extern size_t mod_rcode_table_len; -#define UNWIND_FLAG_NONE 0x00 //!< No flags. -#define UNWIND_FLAG_REPEAT 0x01 //!< Repeat the frame on the way up the stack. -#define UNWIND_FLAG_TOP_FRAME 0x02 //!< are we the top frame of the stack? - ///< If true, causes the interpreter to stop - ///< interpreting and return, control then passes - ///< to whatever called the interpreter. -#define UNWIND_FLAG_BREAK_POINT 0x04 //!< 'break' stops here. -#define UNWIND_FLAG_RETURN_POINT 0x08 //!< 'return' stops here. -#define UNWIND_FLAG_NO_CLEAR 0x10 //!< Keep unwinding, don't clear the unwind flag. -#define UNWIND_FLAG_YIELDED 0x20 //!< frame has yielded - -static inline void repeatable_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FLAG_REPEAT; } -static inline void top_frame_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FLAG_TOP_FRAME; } -static inline void break_point_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FLAG_BREAK_POINT; } -static inline void return_point_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FLAG_RETURN_POINT; } -static inline void yielded_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FLAG_YIELDED; } - -static inline void repeatable_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FLAG_REPEAT; } -static inline void top_frame_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FLAG_TOP_FRAME; } -static inline void break_point_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FLAG_BREAK_POINT; } -static inline void return_point_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FLAG_RETURN_POINT; } -static inline void yielded_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FLAG_YIELDED; } - -static inline bool is_repeatable(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FLAG_REPEAT; } -static inline bool is_top_frame(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FLAG_TOP_FRAME; } -static inline bool is_break_point(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FLAG_BREAK_POINT; } -static inline bool is_return_point(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FLAG_RETURN_POINT; } -static inline bool is_yielded(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FLAG_YIELDED; } +#define UNWIND_FRAME_FLAG_NONE 0x00 //!< No flags. +#define UNWIND_FRAME_FLAG_REPEAT 0x01 //!< Repeat the frame on the way up the stack. +#define UNWIND_FRAME_FLAG_TOP_FRAME 0x02 //!< are we the top frame of the stack? + ///< If true, causes the interpreter to stop + ///< interpreting and return, control then passes + ///< to whatever called the interpreter. +#define UNWIND_FRAME_FLAG_BREAK_POINT 0x04 //!< 'break' stops here. +#define UNWIND_FRAME_FLAG_RETURN_POINT 0x08 //!< 'return' stops here. +#define UNWIND_FRAME_FLAG_NO_CLEAR 0x10 //!< Keep unwinding, don't clear the unwind flag. +#define UNWIND_FRAME_FLAG_YIELDED 0x20 //!< frame has yielded + +static inline void repeatable_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FRAME_FLAG_REPEAT; } +static inline void top_frame_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FRAME_FLAG_TOP_FRAME; } +static inline void break_point_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FRAME_FLAG_BREAK_POINT; } +static inline void return_point_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FRAME_FLAG_RETURN_POINT; } +static inline void yielded_set(unlang_stack_frame_t *frame) { frame->uflags |= UNWIND_FRAME_FLAG_YIELDED; } + +static inline void repeatable_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FRAME_FLAG_REPEAT; } +static inline void top_frame_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FRAME_FLAG_TOP_FRAME; } +static inline void break_point_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FRAME_FLAG_BREAK_POINT; } +static inline void return_point_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FRAME_FLAG_RETURN_POINT; } +static inline void yielded_clear(unlang_stack_frame_t *frame) { frame->uflags &= ~UNWIND_FRAME_FLAG_YIELDED; } + +static inline bool is_repeatable(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FRAME_FLAG_REPEAT; } +static inline bool is_top_frame(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FRAME_FLAG_TOP_FRAME; } +static inline bool is_break_point(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FRAME_FLAG_BREAK_POINT; } +static inline bool is_return_point(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FRAME_FLAG_RETURN_POINT; } +static inline bool is_yielded(unlang_stack_frame_t const *frame) { return frame->uflags & UNWIND_FRAME_FLAG_YIELDED; } static inline unlang_action_t unwind_to_break(unlang_stack_t *stack) { - stack->unwind = UNWIND_FLAG_BREAK_POINT | UNWIND_FLAG_TOP_FRAME; + stack->unwind = UNWIND_FRAME_FLAG_BREAK_POINT | UNWIND_FRAME_FLAG_TOP_FRAME; return UNLANG_ACTION_UNWIND; } static inline unlang_action_t unwind_to_return(unlang_stack_t *stack) { - stack->unwind = UNWIND_FLAG_RETURN_POINT | UNWIND_FLAG_TOP_FRAME; + stack->unwind = UNWIND_FRAME_FLAG_RETURN_POINT | UNWIND_FRAME_FLAG_TOP_FRAME; return UNLANG_ACTION_UNWIND; } static inline unlang_action_t unwind_all(unlang_stack_t *stack) { - stack->unwind = UNWIND_FLAG_TOP_FRAME | UNWIND_FLAG_NO_CLEAR; + stack->unwind = UNWIND_FRAME_FLAG_TOP_FRAME | UNWIND_FRAME_FLAG_NO_CLEAR; return UNLANG_ACTION_UNWIND; } -static inline bool is_stack_unwinding_to_top_frame(unlang_stack_t *stack) { return stack->unwind & UNWIND_FLAG_TOP_FRAME; } -static inline bool is_stack_unwinding_to_break(unlang_stack_t *stack) { return stack->unwind & UNWIND_FLAG_BREAK_POINT; } -static inline bool is_stack_unwinding_to_return(unlang_stack_t *stack) { return stack->unwind & UNWIND_FLAG_RETURN_POINT; } -static inline void stack_unwind_top_frame_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FLAG_TOP_FRAME; } -static inline void stack_unwind_break_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FLAG_BREAK_POINT; } -static inline void stack_unwind_return_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FLAG_RETURN_POINT; } +static inline bool is_stack_unwinding_to_top_frame(unlang_stack_t *stack) { return stack->unwind & UNWIND_FRAME_FLAG_TOP_FRAME; } +static inline bool is_stack_unwinding_to_break(unlang_stack_t *stack) { return stack->unwind & UNWIND_FRAME_FLAG_BREAK_POINT; } +static inline bool is_stack_unwinding_to_return(unlang_stack_t *stack) { return stack->unwind & UNWIND_FRAME_FLAG_RETURN_POINT; } +static inline void stack_unwind_top_frame_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FRAME_FLAG_TOP_FRAME; } +static inline void stack_unwind_break_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FRAME_FLAG_BREAK_POINT; } +static inline void stack_unwind_return_clear(unlang_stack_t *stack) { stack->unwind &= ~UNWIND_FRAME_FLAG_RETURN_POINT; } static inline unlang_stack_frame_t *frame_current(request_t *request) { @@ -457,7 +457,7 @@ static inline void frame_cleanup(unlang_stack_frame_t *frame) /* * Don't clear top_frame flag, bad things happen... */ - frame->uflags &= UNWIND_FLAG_TOP_FRAME; + frame->uflags &= UNWIND_FRAME_FLAG_TOP_FRAME; if (frame->state) { talloc_free_children(frame->state); /* *(ev->parent) = NULL in event.c */ TALLOC_FREE(frame->state);