summaryrefslogtreecommitdiff
path: root/gas/hash.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-08-11 07:40:22 +0000
committerAlan Modra <amodra@gmail.com>2008-08-11 07:40:22 +0000
commit818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9 (patch)
tree818e7a68ac2eeefaa4d0deee8982a4fd0cb74493 /gas/hash.c
parent74235fd7819cda08ee923ccd9759c55b74b0a59b (diff)
downloadbinutils-gdb-818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9.tar.gz
PR 6575
* hash.c: Expand PTR to void *. (hash_delete): Add "freeme" parameter. Call obstack_free. * hash.h: Expand PTR to void *. (hash_delete): Update prototype. * macro.c (macro_expand_body): hash_delete LOCALs from formal_hash. * config/tc-tic54x.c (tic54x_remove_local_label): Update hash_delete call. (subsym_substitute): Likewise. * doc/internals.texi (hash_delete): Update.
Diffstat (limited to 'gas/hash.c')
-rw-r--r--gas/hash.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/gas/hash.c b/gas/hash.c
index 3ef582ddf62..4eab512f504 100644
--- a/gas/hash.c
+++ b/gas/hash.c
@@ -1,6 +1,6 @@
/* hash.c -- gas hash table code
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2005, 2007
+ 2000, 2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -44,7 +44,7 @@ struct hash_entry {
table. */
unsigned long hash;
/* Pointer being stored in the hash table. */
- PTR data;
+ void *data;
};
/* A hash table. */
@@ -223,7 +223,7 @@ hash_lookup (struct hash_control *table, const char *key, size_t len,
hash table. */
const char *
-hash_insert (struct hash_control *table, const char *key, PTR value)
+hash_insert (struct hash_control *table, const char *key, void *value)
{
struct hash_entry *p;
struct hash_entry **list;
@@ -253,7 +253,7 @@ hash_insert (struct hash_control *table, const char *key, PTR value)
error. If an entry already exists, its value is replaced. */
const char *
-hash_jam (struct hash_control *table, const char *key, PTR value)
+hash_jam (struct hash_control *table, const char *key, void *value)
{
struct hash_entry *p;
struct hash_entry **list;
@@ -291,10 +291,10 @@ hash_jam (struct hash_control *table, const char *key, PTR value)
table, this does nothing and returns NULL. */
PTR
-hash_replace (struct hash_control *table, const char *key, PTR value)
+hash_replace (struct hash_control *table, const char *key, void *value)
{
struct hash_entry *p;
- PTR ret;
+ void *ret;
p = hash_lookup (table, key, strlen (key), NULL, NULL);
if (p == NULL)
@@ -345,7 +345,7 @@ hash_find_n (struct hash_control *table, const char *key, size_t len)
for that entry, or NULL if there is no such entry. */
PTR
-hash_delete (struct hash_control *table, const char *key)
+hash_delete (struct hash_control *table, const char *key, int freeme)
{
struct hash_entry *p;
struct hash_entry **list;
@@ -363,9 +363,8 @@ hash_delete (struct hash_control *table, const char *key)
*list = p->next;
- /* Note that we never reclaim the memory for this entry. If gas
- ever starts deleting hash table entries in a big way, this will
- have to change. */
+ if (freeme)
+ obstack_free (&table->memory, p);
return p->data;
}
@@ -375,7 +374,7 @@ hash_delete (struct hash_control *table, const char *key)
void
hash_traverse (struct hash_control *table,
- void (*pfn) (const char *key, PTR value))
+ void (*pfn) (const char *key, void *value))
{
unsigned int i;