From 0e5a699f01e63ef44e40bf30033e17c5f4731ab8 Mon Sep 17 00:00:00 2001 From: Andrew Chambers Date: Wed, 13 Oct 2021 14:07:29 +1300 Subject: Add parsev interning. --- util.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 5cede75..9ed1c50 100644 --- a/util.c +++ b/util.c @@ -76,22 +76,6 @@ char *xmemdup(const char *s, size_t n) { char *xstrdup(const char *s) { return xmemdup(s, strlen(s) + 1); } -const char *internstring(const char *s) { - size_t idx, len; - const char *interned; - static const char *cache[4096] = {0}; - - len = strlen(s); - idx = murmurhash64a(s, len) % sizeof(cache)/sizeof(cache[0]); - interned = cache[idx]; - if (interned && strcmp(s, cache[idx]) == 0) { - return interned; - } - interned = xstrdup(s); - cache[idx] = interned; - return interned; -} - void htabkey(struct hashtablekey *k, const char *s, size_t n) { k->str = s; k->len = n; -- cgit v1.2.3