diff options
| author | Andrew Chambers <[email protected]> | 2021-10-13 14:07:29 +1300 |
|---|---|---|
| committer | Andrew Chambers <[email protected]> | 2021-10-13 14:07:29 +1300 |
| commit | 0e5a699f01e63ef44e40bf30033e17c5f4731ab8 (patch) | |
| tree | d3d9aed902c49784b88327bdcf29577a27241c33 /util.c | |
| parent | 7f51b475428aa2c0b505e1946870cb82a1155409 (diff) | |
Add parsev interning.
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 16 |
1 files changed, 0 insertions, 16 deletions
@@ -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; |
