summaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-12 19:41:30 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-12 19:41:30 +0000
commitc3e4ce9b56611a173152f336c6873caa009e242b (patch)
tree230a45b12a0aeb61272c4410e2c6679f2e10e469 /gcc/cpphash.c
parent826eefff40054441d90f7a2f506973f983f82e49 (diff)
downloadgcc-c3e4ce9b56611a173152f336c6873caa009e242b.tar.gz
* cppexp.c (LOGICAL): Delete macro.
(_cpp_parse_expr): Do not use UNARY for unary +. Implement || and && directly. * cpphash.c (HASHSIZE): Increase to 4096. (struct hashdummy): Add hash field. (eq_HASHNODE): Compare unreduced hashes, then lengths, then the string values using memcmp. (cpp_lookup): Set dummy.hash. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34994 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index c49ba810b9e..d18a4158395 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -37,6 +37,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct hashdummy
{
const U_CHAR *name;
+ unsigned int hash;
unsigned short length;
};
@@ -49,7 +50,7 @@ struct macro_info
};
/* Initial hash table size. (It can grow if necessary - see hashtab.c.) */
-#define HASHSIZE 500
+#define HASHSIZE 4096
static unsigned int hash_HASHNODE PARAMS ((const void *));
static int eq_HASHNODE PARAMS ((const void *, const void *));
@@ -104,7 +105,7 @@ hash_HASHNODE (x)
rule that the existing entry is the first argument, the potential
entry the second. It also relies on the comparison function never
being called except as a direct consequence of a call to
- htab_find(_slot)_with_hash. */
+ the htab_find routines. */
static int
eq_HASHNODE (x, y)
const void *x;
@@ -113,8 +114,9 @@ eq_HASHNODE (x, y)
const cpp_hashnode *a = (const cpp_hashnode *)x;
const struct hashdummy *b = (const struct hashdummy *)y;
- return (a->length == b->length
- && !ustrncmp (a->name, b->name, a->length));
+ return (a->hash == b->hash
+ && a->length == b->length
+ && !memcmp (a->name, b->name, a->length));
}
/* Find the hash node for name "name", of length LEN. */
@@ -132,7 +134,7 @@ cpp_lookup (pfile, name, len)
dummy.name = name;
dummy.length = len;
- hash = _cpp_calc_hash (name, len);
+ dummy.hash = hash = _cpp_calc_hash (name, len);
slot = (cpp_hashnode **)
htab_find_slot_with_hash (pfile->hashtab, (void *)&dummy, hash, INSERT);