aboutsummaryrefslogtreecommitdiff
path: root/asm.peg
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-13 11:40:59 +1300
committerAndrew Chambers <[email protected]>2021-10-13 11:40:59 +1300
commite6326541162130dd4c2121db14c298cd5ad2009c (patch)
tree36693b45d78df0b2551511bdd08f7ab847c035a0 /asm.peg
parent4fc6bfe524c3f708111e4659627d474d73f3352d (diff)
Simple string interning.
Diffstat (limited to 'asm.peg')
-rw-r--r--asm.peg6
1 files changed, 3 insertions, 3 deletions
diff --git a/asm.peg b/asm.peg
index 0a80d3a..f181cfe 100644
--- a/asm.peg
+++ b/asm.peg
@@ -53,8 +53,8 @@ section-directive =
{$$.section = (DirSection){.kind=ASM_DIR_SECTION, .name=n.charptr, .flags="", .type=SHT_PROGBITS}; }
)
-section-name = <[.a-zA-Z0-9\-]+> { $$.charptr = xstrdup(yytext); }
-section-flags = '"' <[awx]*> '"' { $$.charptr = xstrdup(yytext); }
+section-name = <[.a-zA-Z0-9\-]+> { $$.charptr = internstring(yytext); }
+section-flags = '"' <[awx]*> '"' { $$.charptr = internstring(yytext); }
section-type =
"@nobits" { $$.i64 = SHT_NOBITS; }
| "@progbits" { $$.i64 = SHT_PROGBITS; }
@@ -589,7 +589,7 @@ value =
ident =
<[._a-zA-Z][._a-zA-Z0-9]*>
- { $$.charptr = xstrdup(yytext); }
+ { $$.charptr = internstring(yytext); }
number =
'-' ws? n:unsigned-number