From c580da876e6aea7485467ca8e3d19377ecba4fc7 Mon Sep 17 00:00:00 2001 From: crowl Date: Thu, 25 Oct 2012 21:45:28 +0000 Subject: Change hash_table to support a comparator type different from the value type stored in the hash table. The 'find' functions now may take a different type from the value type. This requires introducing a second typedef into the Descriptor conceptual type. Change the Descriptor concept to use typedefs value_type and compare_type instead of T. Change all users to match. Add usage documentation to hash-table.h. Tested on x86-64. Index: gcc/ChangeLog 2012-10-25 Lawrence Crowl * hash-table.h: Add usage documentation. (template struct typed_free_remove): Clarify documentation. Rename template parameter. (struct typed_noop_remove): Likewise. (descriptor concept): Change typedef T to value_type. Add typedef compare_type. Use more precise template parameter name, Descriptor instead of Descr. Update users to match. (struct hash_table): Change 'find' parameters to use compare_type instead of the value type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192823 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/jcf-io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc/java') diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index 97a3c0fbc68..6a24f78ebd4 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -276,19 +276,21 @@ find_classfile (char *filename, JCF *jcf, const char *dep_name) struct charstar_hash : typed_noop_remove { - typedef const char T; - static inline hashval_t hash (const T *candidate); - static inline bool equal (const T *existing, const T *candidate); + typedef const char value_type; + typedef const char compare_type; + static inline hashval_t hash (const value_type *candidate); + static inline bool equal (const value_type *existing, + const compare_type *candidate); }; inline hashval_t -charstar_hash::hash (const T *candidate) +charstar_hash::hash (const value_type *candidate) { return htab_hash_string (candidate); } inline bool -charstar_hash::equal (const T *existing, const T *candidate) +charstar_hash::equal (const value_type *existing, const compare_type *candidate) { return strcmp (existing, candidate) == 0; } -- cgit v1.2.1