From 6153bf6edb45e4ad1759e3db69e3a7358ae28b4e Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Sun, 23 Aug 2026 05:40:51 +0000 Subject: core: Add support for pointer boxes Pointer boxes are a way to manage memory and have all references released after operation, this way they do not need to be manually managed. Signed-off-by: Chloe M. --- core/lexer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/lexer.c') diff --git a/core/lexer.c b/core/lexer.c index 2eb50a1..e93c629 100644 --- a/core/lexer.c +++ b/core/lexer.c @@ -3,6 +3,7 @@ #include #include #include "defconf/lexer.h" +#include "defconf/ptrbox.h" /* Constants */ #define MAX_KW_LEN 32 @@ -109,7 +110,7 @@ lexer_scan_ident(struct defconf_state *state, int lc) if (!isalnum(c) && c != '_') { lexer_putback(state, c); buf[bufind] = '\0'; - return strdup(buf); + return ptrbox_strdup(&state->ptrbox, buf); } buf[bufind++] = c; @@ -177,7 +178,6 @@ lexer_scan(struct defconf_state *state, struct token *result) /* Scan for an identifier */ if ((ident = lexer_scan_ident(state, c)) != NULL) { if (lexer_check_kw(ident, result) == 0) { - free(ident); return 0; } -- cgit v1.2.3