all repos — hex @ 3a1750528b1ba2ea2aff633443ff3885c9f21627

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

Fixes
Fabio Cevasco h3rald@h3rald.com
Fri, 27 Dec 2024 22:55:50 +0100
commit

3a1750528b1ba2ea2aff633443ff3885c9f21627

parent

bcb904c9f945c3d85c1fe9fd553aa505a3c4fa8d

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

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

@@ -70,7 +70,7 @@

ctx->registry->entries[ctx->registry->size] = malloc(sizeof(hex_registry_entry_t)); if (ctx->registry->entries[ctx->registry->size] == NULL) { - hex_error(ctx, "Error: Memory allocation failed for registry entry"); + hex_error(ctx, "[set symbol] Memory allocation failed for registry entry"); return 1; } ctx->registry->entries[ctx->registry->size]->key = strdup(key);

@@ -85,7 +85,7 @@ {

hex_item_t *func_item = malloc(sizeof(hex_item_t)); if (func_item == NULL) { - hex_error(ctx, "Error: Memory allocation failed for native symbol '%s'", name); + hex_error(ctx, "[set native symbol] Memory allocation failed for native symbol '%s'", name); return; } func_item->type = HEX_TYPE_NATIVE_SYMBOL;
M src/stack.csrc/stack.c

@@ -342,14 +342,15 @@ copy->token->value = strdup(item->token->value);

if (copy->token->value == NULL) { hex_error(ctx, "[copy item] Failed to allocate memory for token value"); - free(copy->token); - free(copy); + hex_free_token(copy->token); + hex_free_item(copy); return NULL; } break; default: - free(copy); + hex_error(ctx, "[copy item] Failed to copy %s item", hex_type(item->type)); + hex_free_item(copy); return NULL; }