all repos — hex @ ebb16a0bd544defc76bef8b6e7bde9a27e40e51e

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Fixes.
h3rald h3rald@h3rald.com
Sat, 28 Dec 2024 18:45:10 +0100
commit

ebb16a0bd544defc76bef8b6e7bde9a27e40e51e

parent

672a08667cb681d452f4401b33b6f744d638bf4d

2 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/stack.csrc/stack.c

@@ -443,7 +443,7 @@ break;

default: // Unsupported type - hex_error(ctx, "[copy item] Unsupported item type: %d", item->type); + hex_error(ctx, "[copy item] Unsupported item type: %s", hex_type(item->type)); hex_free_item(ctx, copy); return NULL; }
M src/symbols.csrc/symbols.c

@@ -3174,6 +3174,7 @@ }

int hex_symbol_stack(hex_context_t *ctx) { + hex_item_t **quotation = (hex_item_t **)malloc((ctx->stack->top + 2) * sizeof(hex_item_t)); if (!quotation) {

@@ -3183,15 +3184,14 @@ }

int count = 0; if (ctx->stack->top == -1) { - if (hex_push_quotation(ctx, NULL, 0) != 0) + if (hex_push_quotation(ctx, quotation, 0) != 0) { hex_error(ctx, "[symbol stack] An error occurred while pushing empty quotation"); - hex_free_list(ctx, quotation, count); return 1; } return 0; } - for (size_t i = 0; i <= (size_t)ctx->stack->top + 1; i++) + for (int i = 0; i <= ctx->stack->top; i++) { quotation[i] = hex_copy_item(ctx, ctx->stack->entries[i]); if (!quotation[i])

@@ -3203,7 +3203,7 @@ }

count++; } - if (hex_push_quotation(ctx, quotation, ctx->stack->top + 2) != 0) + if (hex_push_quotation(ctx, quotation, count) != 0) { hex_error(ctx, "[symbol stack] An error occurred while pushing quotation"); hex_free_list(ctx, quotation, count);