1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Fill unused asso_values[] entries in search.cc, not in output.cc.

This commit is contained in:
Bruno Haible
2003-04-01 08:13:30 +00:00
parent 8193024d96
commit 0093e33163
5 changed files with 26 additions and 8 deletions

View File

@@ -1477,6 +1477,21 @@ Search::optimize ()
/* Sorts the keyword list by hash value. */
sort ();
/* Set unused asso_values[c] to max_hash_value + 1. This is not absolutely
necessary, but speeds up the lookup function in many cases of lookup
failure: no string comparison is needed once the hash value of a string
is larger than the hash value of any keyword. */
int max_hash_value;
{
KeywordExt_List *temp;
for (temp = _head; temp->rest(); temp = temp->rest())
;
max_hash_value = temp->first()->_hash_value;
}
for (unsigned int c = 0; c < _alpha_size; c++)
if (_occurrences[c] == 0)
_asso_values[c] = max_hash_value + 1;
}
/* Prints out some diagnostics upon completion. */