diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-10 00:00:24 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-03-10 00:00:24 +0000 |
commit | 3fdd387aa3260f73485373dcc6726c6fe907f4c0 (patch) | |
tree | 1c8555764b859bc239b43c7b7d97a90239ceeb2a /include/hashtab.h | |
parent | 19e447101e84dfd5c6e398207ac6a25c5f49d046 (diff) | |
download | gcc-3fdd387aa3260f73485373dcc6726c6fe907f4c0.tar.gz |
* hashtab.h (struct htab): Add del_f.
(htab_del): New type.
(htab_create): Add fourth argument.
* hashtab.c (htab_create): Set del_f.
(htab_delete, htab_empty, htab_remove_elt, htab_clear_slot):
Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32459 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'include/hashtab.h')
-rw-r--r-- | include/hashtab.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/hashtab.h b/include/hashtab.h index f17572af863..e6e38e4d058 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -47,6 +47,10 @@ typedef unsigned int (*htab_hash) PARAMS ((const void *)); the table always comes first. */ typedef int (*htab_eq) PARAMS ((const void *, const void *)); +/* Cleanup function called whenever a live element is removed from + the hash table. */ +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. */ @@ -62,10 +66,13 @@ struct htab /* Pointer to hash function. */ htab_hash hash_f; - /* Pointer to comparison function. */ + /* Pointer to comparison function. */ htab_eq eq_f; - /* Table itself */ + /* Pointer to cleanup function. */ + htab_del del_f; + + /* Table itself. */ void **entries; /* Current size (in entries) of the hash table */ @@ -90,7 +97,8 @@ typedef struct htab *htab_t; /* The prototypes of the package functions. */ -extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq)); +extern htab_t htab_create PARAMS ((size_t, htab_hash, + htab_eq, htab_del)); extern void htab_delete PARAMS ((htab_t)); extern void htab_empty PARAMS ((htab_t)); |