1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +00:00

Introduce class KeywordExt.

This commit is contained in:
Bruno Haible
2002-11-04 12:09:45 +00:00
parent 5db232cb09
commit 8797dd362b
8 changed files with 93 additions and 58 deletions

View File

@@ -57,7 +57,7 @@ Hash_Table::~Hash_Table (void)
if (table[i])
fprintf (stderr, "%8d, %*.*s, %.*s\n",
i,
field_width, table[i]->char_set_length, table[i]->char_set,
field_width, table[i]->selchars_length, table[i]->selchars,
table[i]->allchars_length, table[i]->allchars);
fprintf (stderr, "\nend dumping hash table\n\n");
@@ -71,14 +71,14 @@ Hash_Table::~Hash_Table (void)
List_Node *
Hash_Table::insert (List_Node *item)
{
unsigned hash_val = hashpjw (item->char_set, item->char_set_length);
unsigned hash_val = hashpjw (item->selchars, item->selchars_length);
int probe = hash_val & (size - 1);
int increment = ((hash_val ^ item->allchars_length) | 1) & (size - 1);
while (table[probe])
{
if (table[probe]->char_set_length == item->char_set_length
&& memcmp (table[probe]->char_set, item->char_set, item->char_set_length) == 0
if (table[probe]->selchars_length == item->selchars_length
&& memcmp (table[probe]->selchars, item->selchars, item->selchars_length) == 0
&& (ignore_length || table[probe]->allchars_length == item->allchars_length))
return table[probe];