aboutsummaryrefslogtreecommitdiff
path: root/src/util.cff
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cff')
-rw-r--r--src/util.cff6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util.cff b/src/util.cff
index 70c80b4..9bb5db9 100644
--- a/src/util.cff
+++ b/src/util.cff
@@ -81,8 +81,10 @@ extern fn fatal(P *Parser, loc Loc, fmt *const u8, ...) void {
extern fn internstr(s *const u8) *const u8 {
static set Set<*const u8, struct {
fn hash(s *const u8) u32 { return fnv1a_s(FNV1A_INI, s); }
- fn eq(a *const u8, b *const u8) bool { return streq(a, b); }
- fn dup(s *const u8) *const u8 { return as(*const u8)xstrdup(s); }
+ 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); }
}> = {};
return *set->intern(s);
}