Refactor inline functions for quotation integrity and stack validation; improves readability and maintains consistency in code style.
h3rald h3rald@h3rald.com
Wed, 10 Sep 2025 18:18:11 +0200
3 files changed,
30 insertions(+),
6 deletions(-)
M
src/hex.c
→
src/hex.c
@@ -386,8 +386,17 @@ #ifdef DEBUG
int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item); int hex_debug_validate_stack(hex_context_t *ctx); #else -static inline int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item) { (void)ctx; (void)item; return 0; } -static inline int hex_debug_validate_stack(hex_context_t *ctx) { (void)ctx; return 0; } +static inline int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item) +{ + (void)ctx; + (void)item; + return 0; +} +static inline int hex_debug_validate_stack(hex_context_t *ctx) +{ + (void)ctx; + return 0; +} #endif // Opcodes@@ -6805,7 +6814,10 @@ }
int hex_debug_validate_stack(hex_context_t *ctx) { - if (!ctx || !ctx->stack) { return 0; } + if (!ctx || !ctx->stack) + { + return 0; + } for (int i = 0; i <= ctx->stack->top; i++) { hex_item_t *it = ctx->stack->entries[i];
M
src/hex.h
→
src/hex.h
@@ -383,8 +383,17 @@ #ifdef DEBUG
int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item); int hex_debug_validate_stack(hex_context_t *ctx); #else -static inline int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item) { (void)ctx; (void)item; return 0; } -static inline int hex_debug_validate_stack(hex_context_t *ctx) { (void)ctx; return 0; } +static inline int hex_validate_quotation_integrity(hex_context_t *ctx, const hex_item_t *item) +{ + (void)ctx; + (void)item; + return 0; +} +static inline int hex_debug_validate_stack(hex_context_t *ctx) +{ + (void)ctx; + return 0; +} #endif // Opcodes
M
src/symbols.c
→
src/symbols.c
@@ -2849,7 +2849,10 @@ }
int hex_debug_validate_stack(hex_context_t *ctx) { - if (!ctx || !ctx->stack) { return 0; } + if (!ctx || !ctx->stack) + { + return 0; + } for (int i = 0; i <= ctx->stack->top; i++) { hex_item_t *it = ctx->stack->entries[i];