From: handa Date: Mon, 29 Mar 2004 03:55:42 +0000 (+0000) Subject: (msymbol__fini): Set freed_symbols to 0. Set all X-Git-Tag: REL-1-0-2~7 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=487dc2b13065f7c619ce22fc02eaab213301ffa6;p=m17n%2Fm17n-lib.git (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. --- 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; }