char string[1]; /* Null-terminated string. */
};
/* All interned strings. */
static struct hmap interns = HMAP_INITIALIZER (interns);
char string[1]; /* Null-terminated string. */
};
/* All interned strings. */
static struct hmap interns = HMAP_INITIALIZER (interns);
static struct interned_string *
intern_lookup__ (const char *s, size_t length, unsigned int hash)
{
struct interned_string *is;
HMAP_FOR_EACH_WITH_HASH (is, struct interned_string, node, hash, &interns)
static struct interned_string *
intern_lookup__ (const char *s, size_t length, unsigned int hash)
{
struct interned_string *is;
HMAP_FOR_EACH_WITH_HASH (is, struct interned_string, node, hash, &interns)
is = xmalloc (length + sizeof *is);
hmap_insert (&interns, &is->node, hash);
is->ref_cnt = 1;
is = xmalloc (length + sizeof *is);
hmap_insert (&interns, &is->node, hash);
is->ref_cnt = 1;
unsigned int hash = hash_bytes (s, length, 0);
return intern_lookup__ (s, length, hash) != NULL;
}
unsigned int hash = hash_bytes (s, length, 0);
return intern_lookup__ (s, length, hash) != NULL;
}