diff options
Diffstat (limited to 'contrib/gcc/hashtable.c')
-rw-r--r-- | contrib/gcc/hashtable.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/gcc/hashtable.c b/contrib/gcc/hashtable.c index bd2b137..ed1e81f 100644 --- a/contrib/gcc/hashtable.c +++ b/contrib/gcc/hashtable.c @@ -45,7 +45,7 @@ static void ht_expand PARAMS ((hash_table *)); #define OBSTACK_CHUNK_FREE free #endif -/* Initialise an obstack. */ +/* Initialize an obstack. */ void gcc_obstack_init (obstack) struct obstack *obstack; @@ -141,7 +141,8 @@ ht_lookup (table, str, len, insert) if (node == NULL) break; - if (HT_LEN (node) == len && !memcmp (HT_STR (node), str, len)) + if (node->hash_value == hash && HT_LEN (node) == len + && !memcmp (HT_STR (node), str, len)) { if (insert == HT_ALLOCED) /* The string we search for was placed at the end of the @@ -161,6 +162,7 @@ ht_lookup (table, str, len, insert) table->entries[index] = node; HT_LEN (node) = len; + node->hash_value = hash; if (insert == HT_ALLOC) HT_STR (node) = obstack_copy0 (&table->stack, str, len); else @@ -193,7 +195,7 @@ ht_expand (table) { unsigned int index, hash, hash2; - hash = calc_hash (HT_STR (*p), HT_LEN (*p)); + hash = (*p)->hash_value; hash2 = ((hash * 17) & sizemask) | 1; index = hash & sizemask; |