Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -202,23 +202,17 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_ { - size_t count = [array count]; - - if (count > INT_MAX) - @throw [OFOutOfRangeException newWithClass: isa]; - - if (state->state >= count) - return 0; - - state->state = count; - state->itemsPtr = [array cArray]; + int ret = [super countByEnumeratingWithState: state + objects: objects + count: count_]; + state->mutationsPtr = &mutations; - return (int)count; + return ret; } - (OFEnumerator*)objectEnumerator { return [[[OFArrayEnumerator alloc] Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -246,27 +246,17 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_ { - int i; - - for (i = 0; i < count_; i++) { - for (; state->state < size && (data[state->state] == NULL || - data[state->state] == DELETED); state->state++); - - if (state->state < size) { - objects[i] = data[state->state]->key; - state->state++; - } else - break; - } - - state->itemsPtr = objects; + int ret = [super countByEnumeratingWithState: state + objects: objects + count: count_]; + state->mutationsPtr = &mutations; - return i; + return ret; } - (OFEnumerator*)objectEnumerator { return [[[OFDictionaryObjectEnumerator alloc] Index: src/OFMutableSet.m ================================================================== --- src/OFMutableSet.m +++ src/OFMutableSet.m @@ -42,40 +42,14 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count { - OFAutoreleasePool *pool = state->extra.pointers[0]; - OFEnumerator *enumerator = state->extra.pointers[1]; - int i; + int ret = [super countByEnumeratingWithState: state + objects: objects + count: count]; - state->itemsPtr = objects; state->mutationsPtr = &mutations; - if (state->state == -1) - return 0; - - if (state->state == 0) { - pool = [[OFAutoreleasePool alloc] init]; - enumerator = [dictionary keyEnumerator]; - - state->extra.pointers[0] = pool; - state->extra.pointers[1] = enumerator; - - state->state = 1; - } - - for (i = 0; i < count; i++) { - id object = [enumerator nextObject]; - - if (object == nil) { - [pool release]; - state->state = -1; - return i; - } - - objects[i] = object; - } - - return count; + return ret; } @end