From 3e07912b32a7f324244bbe03783154b30e27a003 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 4 Jun 2004 11:43:51 +0000 Subject: [PATCH] (mdebug__register_object): New function. (mdebug__unregister_object): Likewise. --- src/m17n-core.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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 */ -- 1.7.10.4