diff options
author | kan <kan@FreeBSD.org> | 2003-07-11 03:40:53 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2003-07-11 03:40:53 +0000 |
commit | b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180 (patch) | |
tree | f6b0610f4a17fd26aa234354f050080f789861a4 /contrib/gcc/hashtable.c | |
parent | 52e69d78eee5612ac195e0701a5cebe40d1ab0e1 (diff) | |
download | FreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.zip FreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.tar.gz |
Gcc 3.3.1-pre as of 2003-07-11.
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; |