From: handa Date: Fri, 4 Jun 2004 11:43:51 +0000 (+0000) Subject: (mdebug__register_object): New function. X-Git-Tag: withdl~106 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e07912b32a7f324244bbe03783154b30e27a003;p=m17n%2Fm17n-lib.git (mdebug__register_object): New function. (mdebug__unregister_object): Likewise. --- diff --git a/src/m17n-core.c b/src/m17n-core.c index 96567c4..cdc63f8 100644 --- a/src/m17n-core.c +++ b/src/m17n-core.c @@ -408,6 +408,33 @@ mdebug__print_time () } while (0) +void +mdebug__register_object (M17NObjectArray *array, void *object) +{ + if (array->used == 0) + MLIST_INIT1 (array, objects, 256); + array->count++; + MLIST_APPEND1 (array, objects, object, MERROR_OBJECT); +} + +void +mdebug__unregister_object (M17NObjectArray *array, void *object) +{ + array->count--; + if (array->count >= 0) + { + int i = 0; + + while (i < array->used && array->objects[i] != object) i++; + if (i < array->used) + array->objects[i] = NULL; + else + mdebug_hook (); + } + else \ + mdebug_hook (); +} + /* External API */