@@ -94,10 +94,12 @@ last->next = o; last = o; if (first == NULL) first = o; + + count++; if (retain_and_release) [obj retain]; return o; @@ -116,10 +118,12 @@ first->prev = o; first = o; if (last == NULL) last = o; + + count++; if (retain_and_release) [obj retain]; return o; @@ -140,10 +144,12 @@ listobj->prev = o; if (listobj == first) first = o; + + count++; if (retain_and_release) [obj retain]; return o; @@ -164,10 +170,12 @@ listobj->next = o; if (listobj == last) last = o; + + count++; if (retain_and_release) [obj retain]; return o; @@ -182,10 +190,12 @@ if (first == listobj) first = listobj->next; if (last == listobj) last = listobj->prev; + + count--; if (retain_and_release) [listobj->object release]; [self freeMemory: listobj]; @@ -193,17 +203,11 @@ return self; } - (size_t)count { - size_t i; - of_list_object_t *iter; - - for (i = 0, iter = first; iter != NULL; iter = iter->next) - i++; - - return i; + return count; } - (BOOL)isEqual: (id)obj { of_list_object_t *iter, *iter2; @@ -245,10 +249,13 @@ if (new->first == NULL) new->first = o; if (prev != NULL) prev->next = o; + + new->count++; + if (retain_and_release) [o->object retain]; prev = o; }