summaryrefslogtreecommitdiff
path: root/include/hashtab.h
diff options
context:
space:
mode:
authorcrux <crux@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-14 18:28:45 +0000
committercrux <crux@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-14 18:28:45 +0000
commited26da85e5631cfea3739226f8c0fbfd9ec2e5c8 (patch)
tree60489c4e417b408a51b10fe79aaf66b0b4796d7b /include/hashtab.h
parentd4ea3b1f6e99759a511e8a94f3f4200e30eb82cf (diff)
downloadgcc-ed26da85e5631cfea3739226f8c0fbfd9ec2e5c8.tar.gz
Some cleanups/additions for hashtables
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32536 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'include/hashtab.h')
-rw-r--r--include/hashtab.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/hashtab.h b/include/hashtab.h
index e6e38e4d058..5fe239391ff 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -44,7 +44,10 @@ extern "C" {
typedef unsigned int (*htab_hash) PARAMS ((const void *));
/* Compare a table entry with a possible entry. The entry already in
- the table always comes first. */
+ the table always comes first, so the second element can be of a
+ different type (but in this case htab_find and htab_find_slot
+ cannot be used; instead the variants that accept a hash value
+ must be used). */
typedef int (*htab_eq) PARAMS ((const void *, const void *));
/* Cleanup function called whenever a live element is removed from
@@ -52,9 +55,10 @@ typedef int (*htab_eq) PARAMS ((const void *, const void *));
typedef void (*htab_del) PARAMS ((void *));
/* Function called by htab_traverse for each live element. The first
- arg is the element, the second arg is the auxiliary pointer handed
- to htab_traverse. Return 1 to continue scan, 0 to stop. */
-typedef int (*htab_trav) PARAMS ((void *, void *));
+ arg is the slot of the element (which can be passed to htab_clear_slot
+ if desired), the second arg is the auxiliary pointer handed to
+ htab_traverse. Return 1 to continue scan, 0 to stop. */
+typedef int (*htab_trav) PARAMS ((void **, void *));
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
@@ -104,6 +108,10 @@ extern void htab_empty PARAMS ((htab_t));
extern void *htab_find PARAMS ((htab_t, const void *));
extern void **htab_find_slot PARAMS ((htab_t, const void *, int));
+extern void *htab_find_with_hash PARAMS ((htab_t, const void *,
+ unsigned int));
+extern void **htab_find_slot_with_hash PARAMS ((htab_t, const void *,
+ unsigned int, int));
extern void htab_clear_slot PARAMS ((htab_t, void **));
extern void htab_remove_elt PARAMS ((htab_t, void *));