aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-10 00:00:24 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-10 00:00:24 +0000
commit5dc9cffdfd6fb65d46193fe95b3f6ecea1242b7d (patch)
tree1c8555764b859bc239b43c7b7d97a90239ceeb2a /include
parentaa77ac5f237e2b0a646631ec7088b8c7bdd14fd3 (diff)
downloadgcc-5dc9cffdfd6fb65d46193fe95b3f6ecea1242b7d.zip
gcc-5dc9cffdfd6fb65d46193fe95b3f6ecea1242b7d.tar.gz
gcc-5dc9cffdfd6fb65d46193fe95b3f6ecea1242b7d.tar.bz2
hashtab.h (struct htab): Add del_f.
* 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. From-SVN: r32459
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog6
-rw-r--r--include/hashtab.h14
2 files changed, 17 insertions, 3 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 5ab66bc..a73e5fe 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2000-03-09 Zack Weinberg <zack@wolery.cumb.org>
+
+ * hashtab.h (struct htab): Add del_f.
+ (htab_del): New type.
+ (htab_create): Add fourth argument.
+
2000-03-08 Zack Weinberg <zack@wolery.cumb.org>
* hashtab.h (hash_table_t): Rename to htab_t.
diff --git a/include/hashtab.h b/include/hashtab.h
index f17572a..e6e38e4 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));