summaryrefslogtreecommitdiffstats
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-30 17:11:25 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-30 17:11:25 +0000
commit14feeebae23fbc4a1c7b54d10e34fe8473029e6f (patch)
treeb2cbd4667ef9d395099460fd9be30ff0ec56ed29 /gcc/cpphash.c
parent490d830ff8b0eddafa9b2655a06eccdc5d91d5ab (diff)
downloadppe42-gcc-14feeebae23fbc4a1c7b54d10e34fe8473029e6f.tar.gz
ppe42-gcc-14feeebae23fbc4a1c7b54d10e34fe8473029e6f.zip
* cppfiles.c (redundant_include_p): Provide length of token to
cpp_defined. * cpphash.c (_cpp_make_hashnode, _cpp_lookup_slot): Hash values are unsigned int. (_cpp_lookup, _cpp_lookup_slot): Do not calculate the length. (_cpp_lookup_slot): Do not calculate the hash, either. * cpphash.h: Update prototypes. * cpplib.c (do_define, do_undef, do_pragma_poison, do_assert): Hashes are unsigned int. Calculate hash here, pass by value to _cpp_lookup_slot. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33551 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index 4c45161ee74..4eb2d9d33e6 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -246,7 +246,7 @@ _cpp_make_hashnode (name, len, type, hash)
const U_CHAR *name;
size_t len;
enum node_type type;
- unsigned long hash;
+ unsigned int hash;
{
HASHNODE *hp = (HASHNODE *) xmalloc (sizeof (HASHNODE));
U_CHAR *p = xmalloc (len + 1);
@@ -263,11 +263,7 @@ _cpp_make_hashnode (name, len, type, hash)
return hp;
}
-/* Find the hash node for name "name", which ends at the first
- non-identifier char.
-
- If LEN is >= 0, it is the length of the name.
- Otherwise, compute the length now. */
+/* Find the hash node for name "name", of length LEN. */
HASHNODE *
_cpp_lookup (pfile, name, len)
@@ -278,12 +274,6 @@ _cpp_lookup (pfile, name, len)
const U_CHAR *bp;
HASHNODE dummy;
- if (len < 0)
- {
- for (bp = name; is_idchar (*bp); bp++);
- len = bp - name;
- }
-
dummy.name = name;
dummy.length = len;
dummy.hash = _cpp_calc_hash (name, len);
@@ -300,30 +290,18 @@ _cpp_lookup_slot (pfile, name, len, insert, hash)
const U_CHAR *name;
int len;
enum insert_option insert;
- unsigned long *hash;
+ unsigned int hash;
{
const U_CHAR *bp;
HASHNODE dummy;
- HASHNODE **slot;
-
- if (len < 0)
- {
- for (bp = name; is_idchar (*bp); bp++)
- ;
-
- len = bp - name;
- }
dummy.name = name;
dummy.length = len;
- dummy.hash = _cpp_calc_hash (name, len);
+ dummy.hash = hash;
- slot = (HASHNODE **) htab_find_slot_with_hash (pfile->hashtab,
+ return (HASHNODE **) htab_find_slot_with_hash (pfile->hashtab,
(void *) &dummy,
dummy.hash, insert);
- if (insert)
- *hash = dummy.hash;
- return slot;
}
/* Init the hash table. In here so it can see the hash and eq functions. */
OpenPOWER on IntegriCloud