diff options
| author | 2022-08-13 11:04:44 +0200 | |
|---|---|---|
| committer | 2022-08-13 11:04:44 +0200 | |
| commit | 5b95abb249604e7df9be1d63b1f3dc85b8f5990b (patch) | |
| tree | 5f7065f9bea68e46c925552392541d72dc8de1a6 /src/util.cff | |
| parent | dd4536a8b0dbb770ee1e9e7e492a75157ba0f8e6 (diff) | |
set more
Diffstat (limited to 'src/util.cff')
| -rw-r--r-- | src/util.cff | 6 |
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); } |