From c1a9413ef387a4ce9723b1a9ca68ed5acfcda1d5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 15 Feb 2026 14:19:24 -0500 Subject: [PATCH] symbol: Make symbol result optional Signed-off-by: Ian Moffett --- core/symbol.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/symbol.c b/core/symbol.c index 8fd1489..9a22e3d 100644 --- a/core/symbol.c +++ b/core/symbol.c @@ -66,10 +66,6 @@ symbol_new(struct symbol_table *table, const char *name, symtype_t type, return -1; } - if (res == NULL) { - return -1; - } - if ((symbol = malloc(sizeof(*symbol))) == NULL) { return -1; } @@ -82,5 +78,10 @@ symbol_new(struct symbol_table *table, const char *name, symtype_t type, /* Add symbol to symbol table */ ++table->symbol_count; TAILQ_INSERT_TAIL(&table->entries, symbol, link); + + if (res != NULL) { + *res = symbol; + } + return 0; }