From: handa Date: Fri, 25 May 2007 12:57:39 +0000 (+0000) Subject: (mdebug__unregister_object): Small optimization. X-Git-Tag: FLT-base~31 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7be3dda58ae6e091334fa72ab3cadd32a0a44c77;p=m17n%2Fm17n-lib.git (mdebug__unregister_object): Small optimization. --- diff --git a/src/m17n-core.c b/src/m17n-core.c index 66fef04..6257ad9 100644 --- a/src/m17n-core.c +++ b/src/m17n-core.c @@ -490,11 +490,15 @@ mdebug__unregister_object (M17NObjectArray *array, void *object) array->count--; if (array->count >= 0) { - int i = 0; + int i; - while (i < array->used && array->objects[i] != object) i++; - if (i < array->used) - array->objects[i] = NULL; + for (i = array->used - 1; i >= 0 && array->objects[i] != object; i--); + if (i >= 0) + { + if (i == array->used - 1) + array->used--; + array->objects[i] = NULL; + } else mdebug_hook (); }