From 818236e51ddfafe9688b99e1ce5ddc3d2dc4a0a9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 11 Aug 2008 07:40:22 +0000 Subject: 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. --- gas/macro.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gas/macro.c') 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); -- cgit v1.1