@@ 1,8 1,8 @@
import "util.hff";
import "cffc.hff";
import "set.hff";
-import "mem.hff";
import "common.hff";
+import "mem.hff";
extern fn xmalloc(n usize) *void {
let p = malloc(n);
@@ 80,7 80,13 @@ extern fn internstr(s *const u8) *const u8 {
fn eq(a *const u8, b *const u8) bool {
return a != #null and b != #null and streq(a, b);
}
- fn dup(s *const u8) *const u8 { return xstrdup(s); }
+ fn dup(s *const u8) *const u8 {
+ static arena Arena = {};
+ let n = strlen(s) + 1;
+ let p = Arena:allocf(&arena, n, 1);
+ memcpy(p, s, n);
+ return p;
+ }
}> = {};
return *set->intern(s);
}