From 487dc2b13065f7c619ce22fc02eaab213301ffa6 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 29 Mar 2004 03:55:42 +0000 Subject: [PATCH] (msymbol__fini): Set freed_symbols to 0. Set all elements of symbol_table to NULL. Report about created and freed symbols if MDEBUG_FINI is set. --- src/symbol.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/symbol.c b/src/symbol.c index f85db6c..3e7258c 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -160,6 +160,7 @@ msymbol__fini () { int i; MSymbol sym, next; + int freed_symbols = 0; for (i = 0; i < SYMBOL_TABLE_SIZE; i++) for (sym = symbol_table[i]; sym; sym = sym->next) @@ -170,12 +171,20 @@ msymbol__fini () M17N_OBJECT_UNREF (sym->plist.next); } for (i = 0; i < SYMBOL_TABLE_SIZE; i++) - for (sym = symbol_table[i]; sym; sym = next) - { - next = sym->next; - free (sym->name); - free (sym); - } + { + for (sym = symbol_table[i]; sym; sym = next) + { + next = sym->next; + free (sym->name); + free (sym); + freed_symbols++; + } + symbol_table[i] = NULL; + } + if (mdebug__flag & MDEBUG_FINI) + fprintf (stderr, "%16s %7d %7d %7d\n", "Symbol", + num_symbols, freed_symbols, num_symbols - freed_symbols); + num_symbols = 0; } -- 1.7.10.4