aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/jcf-io.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-06-25 17:16:23 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-06-25 17:16:23 +0000
commit20d2c372c21b9f92b30428d7b545af320d7d2303 (patch)
treeef11c0ce585dd35735de0a607dd716f3fa308d6e /gcc/java/jcf-io.c
parent84a98514b3d659ab6ca4b6bc624a1b7453fa0daa (diff)
downloadgcc-20d2c372c21b9f92b30428d7b545af320d7d2303.zip
gcc-20d2c372c21b9f92b30428d7b545af320d7d2303.tar.gz
gcc-20d2c372c21b9f92b30428d7b545af320d7d2303.tar.bz2
hash-traits.h (string_hash, [...]): New classes.
gcc/ * hash-traits.h (string_hash, nofree_string_hash): New classes. * genmatch.c (capture_id_map_hasher): Use nofree_string_hash. * passes.c (pass_registry_hasher): Likewise. * config/alpha/alpha.c (string_traits): Likewise. * config/i386/winnt.c (i386_find_on_wrapper_list): Likewise. * config/m32c/m32c.c (pragma_traits): Likewise. * config/mep/mep.c (pragma_traits): Likewise. gcc/java/ * jcf-io.c (memoized_class_lookups): Use nofree_string_hash. (find_class): Likewise. From-SVN: r224971
Diffstat (limited to 'gcc/java/jcf-io.c')
-rw-r--r--gcc/java/jcf-io.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c
index 91fe952..be251d4 100644
--- a/gcc/java/jcf-io.c
+++ b/gcc/java/jcf-io.c
@@ -272,33 +272,11 @@ find_classfile (char *filename, JCF *jcf, const char *dep_name)
return open_class (filename, jcf, fd, dep_name);
}
-
-/* Hash table helper. */
-
-struct charstar_hash : nofree_ptr_hash <const char>
-{
- static inline hashval_t hash (const char *candidate);
- static inline bool equal (const char *existing, const char *candidate);
-};
-
-inline hashval_t
-charstar_hash::hash (const char *candidate)
-{
- return htab_hash_string (candidate);
-}
-
-inline bool
-charstar_hash::equal (const char *existing, const char *candidate)
-{
- return strcmp (existing, candidate) == 0;
-}
-
-
/* A hash table keeping track of class names that were not found
during class lookup. (There is no need to cache the values
associated with names that were found; they are saved in
IDENTIFIER_CLASS_VALUE.) */
-static hash_table<charstar_hash> *memoized_class_lookups;
+static hash_table<nofree_string_hash> *memoized_class_lookups;
/* Returns a freshly malloc'd string with the fully qualified pathname
of the .class file for the class CLASSNAME. CLASSNAME must be
@@ -321,11 +299,11 @@ find_class (const char *classname, int classname_length, JCF *jcf)
/* Create the hash table, if it does not already exist. */
if (!memoized_class_lookups)
- memoized_class_lookups = new hash_table<charstar_hash> (37);
+ memoized_class_lookups = new hash_table<nofree_string_hash> (37);
/* Loop for this class in the hashtable. If it is present, we've
already looked for this class and failed to find it. */
- hash = charstar_hash::hash (classname);
+ hash = nofree_string_hash::hash (classname);
if (memoized_class_lookups->find_with_hash (classname, hash))
return NULL;