diff options
| author | Chloe M. <chloe@aptel.org> | 2026-08-23 05:40:51 +0000 |
|---|---|---|
| committer | Chloe M. <chloe@aptel.org> | 2026-08-23 05:40:51 +0000 |
| commit | 6153bf6edb45e4ad1759e3db69e3a7358ae28b4e (patch) | |
| tree | c6cad42382502e7f3a9cc840b6df12480d07f1ef /core/lexer.c | |
| parent | 78b925a4d86b57e58e6322b7cad7bc47098618fd (diff) | |
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. <chloe@aptel.org>
Diffstat (limited to 'core/lexer.c')
| -rw-r--r-- | core/lexer.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 <stdlib.h> #include <string.h> #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; } |
