aboutsummaryrefslogtreecommitdiff
path: root/gas/macro.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/macro.c
parent74235fd7819cda08ee923ccd9759c55b74b0a59b (diff)
downloadgdb-818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9.zip
gdb-818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9.tar.gz
gdb-818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9.tar.bz2
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/macro.c')
-rw-r--r--gas/macro.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 1acc3a6..0cde3d6 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -1,6 +1,6 @@
/* macro.c - macro support for gas
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
@@ -968,11 +968,11 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
while (loclist != NULL)
{
formal_entry *f;
+ const char *name;
f = loclist->next;
- /* Setting the value to NULL effectively deletes the entry. We
- avoid calling hash_delete because it doesn't reclaim memory. */
- hash_jam (formal_hash, sb_terminate (&loclist->name), NULL);
+ name = sb_terminate (&loclist->name);
+ hash_delete (formal_hash, name, f == NULL);
del_formal (loclist);
loclist = f;
}
@@ -1270,7 +1270,9 @@ delete_macro (const char *name)
copy[i] = TOLOWER (name[i]);
copy[i] = '\0';
- /* Since hash_delete doesn't free memory, just clear out the entry. */
+ /* We can only ask hash_delete to free memory if we are deleting
+ macros in reverse order to their definition.
+ So just clear out the entry. */
if ((macro = hash_find (macro_hash, copy)) != NULL)
{
hash_jam (macro_hash, copy, NULL);