From d6ea4e809a2514503767c68548d59e6cf50ff510 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 13 Apr 2004 15:23:19 +0000 Subject: [PATCH] merge from gcc --- include/ChangeLog | 4 ++++ include/hashtab.h | 1 + libiberty/ChangeLog | 5 +++++ libiberty/hashtab.c | 18 ++++++++++++++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 883088ea6df..e2b5e891858 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2004-04-13 Jeff Law + + * hashtab.h (htab_remove_elt_with_hash): Prototype new function. + 2004-03-30 Zack Weinberg * hashtab.h, splay-tree.h: Use new shorter form of GTY markers. diff --git a/include/hashtab.h b/include/hashtab.h index 1af7368d338..a2ef32c36ae 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -166,6 +166,7 @@ extern PTR *htab_find_slot_with_hash PARAMS ((htab_t, const void *, enum insert_option)); extern void htab_clear_slot PARAMS ((htab_t, void **)); extern void htab_remove_elt PARAMS ((htab_t, void *)); +extern void htab_remove_elt_with_hash PARAMS ((htab_t, void *, hashval_t)); extern void htab_traverse PARAMS ((htab_t, htab_trav, void *)); extern void htab_traverse_noresize PARAMS ((htab_t, htab_trav, void *)); diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 661ca4b45b9..7da2d46d608 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2004-04-13 Jeff Law + + * hashtab.c (htab_remove_elt_with_hash): New function. + (htab_remove_elt): Implement in terms of htab_remove_elt_with_hash. + 2004-03-31 Richard Henderson * hashtab.c (htab_size): Move to top of file; mark inline. diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index f7751664f04..2639428df9c 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -599,18 +599,32 @@ htab_find_slot (htab, element, insert) insert); } +/* This function deletes an element with the given value from hash + table (the hash is computed from the element). If there is no matching + element in the hash table, this function does nothing. */ + +void +htab_remove_elt (htab, element) + htab_t htab; + PTR element; +{ + htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element)); +} + + /* This function deletes an element with the given value from hash table. If there is no matching element in the hash table, this function does nothing. */ void -htab_remove_elt (htab, element) +htab_remove_elt_with_hash (htab, element, hash) htab_t htab; PTR element; + hashval_t hash; { PTR *slot; - slot = htab_find_slot (htab, element, NO_INSERT); + slot = htab_find_slot_with_hash (htab, element, hash, NO_INSERT); if (*slot == EMPTY_ENTRY) return; -- 2.30.2