From: handa Date: Wed, 17 Aug 2005 11:35:11 +0000 (+0000) Subject: (msymbol__fini): Don't free symbols here. X-Git-Tag: REL-1-3-0~291 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=522c9d98846c1098b5d91e62821fe86537bf36ab;p=m17n%2Fm17n-lib.git (msymbol__fini): Don't free symbols here. (msymbol__free_table): New function. (msymbol_is_managing_key): New function. --- diff --git a/src/symbol.c b/src/symbol.c index ae11459..2dd32d3 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -148,8 +148,7 @@ void msymbol__fini () { int i; - MSymbol sym, next; - int freed_symbols = 0; + MSymbol sym; for (i = 0; i < SYMBOL_TABLE_SIZE; i++) for (sym = symbol_table[i]; sym; sym = sym->next) @@ -158,7 +157,17 @@ msymbol__fini () if (sym->plist.key->managing_key) M17N_OBJECT_UNREF (sym->plist.val); M17N_OBJECT_UNREF (sym->plist.next); + sym->plist.key = Mnil; } +} + +void +msymbol__free_table () +{ + int i; + MSymbol sym, next; + int freed_symbols = 0; + for (i = 0; i < SYMBOL_TABLE_SIZE; i++) { for (sym = symbol_table[i]; sym; sym = next) @@ -469,6 +478,23 @@ msymbol_as_managing_key (const char *name) /*=*/ /***en + @brief Check if a symbol is a managing key. + + The msymbol_is_managing_key () function checks if the sysmbol + $SYMBOL is a managing key or not. + + @return Return 1 if the symbol is a managing key. Otherwise, + return 0. */ + +int +msymbol_is_managing_key (MSymbol symbol) +{ + return (symbol->managing_key == 1); +} + +/*=*/ + +/***en @brief Search for a symbol that has a specified name. The msymbol_exist () function searches for the symbol whose name