summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2003-06-10 11:51:08 +0000
committerEric Blake <ebb9@byu.net>2007-10-05 21:58:30 -0600
commit6cceb57a3ded5e5d85684676c3facd725d9ed898 (patch)
tree5f156bfd2e59e73a6f1c43762b5034a21a359494
parentf54a4fcdfdcbac8177a4082580787400a60e8c40 (diff)
downloadm4-6cceb57a3ded5e5d85684676c3facd725d9ed898.tar.gz
* m4/symtab.c (m4_symbol_popdef): Need to pass the hash address to
the destroy callback. (m4_arg_destroy): Use the hash address to free the hash node key field.
-rw-r--r--ChangeLog7
-rw-r--r--m4/symtab.c14
2 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index f6133718..ad8508ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-10 Gary V. Vaughan <gary@gnu.org>
+
+ * m4/symtab.c (m4_symbol_popdef): Need to pass the hash address to
+ the destroy callback.
+ (m4_arg_destroy): Use the hash address to free the hash node key
+ field.
+
2003-06-06 Gary V. Vaughan <gary@gnu.org>
First cut at formal parameters in macros.
diff --git a/m4/symtab.c b/m4/symtab.c
index bd624c1b..94dc0b7d 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -46,8 +46,8 @@
static int m4_symbol_destroy (const void *name, void *symbol,
void *symtab);
-static int m4_arg_destroy (const void *ignored, void *arg,
- void *also_ignored);
+static int m4_arg_destroy (const void *name, void *arg,
+ void *arg_signature);
/* Pointer to symbol table. */
m4_hash *m4_symtab = 0;
@@ -220,7 +220,7 @@ m4_symbol_popdef (const char *name)
if (TOKEN_ARG_SIGNATURE (stale))
{
m4_hash_apply (TOKEN_ARG_SIGNATURE (stale),
- m4_arg_destroy, NULL);
+ m4_arg_destroy, TOKEN_ARG_SIGNATURE (stale));
m4_hash_delete (TOKEN_ARG_SIGNATURE (stale));
}
if (TOKEN_TYPE (stale) == M4_TOKEN_TEXT)
@@ -250,13 +250,17 @@ m4_symbol_delete (const char *name)
/* Callback used by m4_symbol_popdef () to release the memory used
by values in the arg_signature hash. */
static int
-m4_arg_destroy (const void *ignored, void *arg, void *also_ignored)
+m4_arg_destroy (const void *name, void *arg, void *arg_signature)
{
struct m4_token_arg *token_arg = (struct m4_token_arg *) arg;
+ assert (name);
+ assert (arg_signature);
+
if (TOKEN_ARG_DEFAULT (token_arg))
XFREE (TOKEN_ARG_DEFAULT (token_arg));
- xfree (arg);
+ xfree (token_arg);
+ xfree (m4_hash_remove ((m4_hash *) arg_signature, (const char *) name));
return 0;
}