Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -66,11 +66,14 @@ /// Pointer to a C array of objects to return id *itemsPtr; /// Arbitrary state information to detect mutations unsigned long *mutationsPtr; /// Additional arbitrary state information - unsigned long extra[5]; + union { + unsigned long longs[5]; + void *pointers[2]; + } extra; } of_fast_enumeration_state_t; #endif /** * \brief A protocol for fast enumeration. Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -392,26 +392,34 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_ { - of_list_object_t **listObject = (of_list_object_t**)state->extra; + of_list_object_t *listObject = state->extra.pointers[0]; + int i; state->itemsPtr = objects; state->mutationsPtr = &mutations; if (state->state == 0) { - *listObject = firstListObject; + listObject = firstListObject; state->state = 1; } - if (*listObject == NULL) - return 0; + for (i = 0; i < count_; i++) { + if (listObject == NULL) { + state->extra.pointers[0] = NULL; + return i; + } + + objects[i] = listObject->object; + listObject = listObject->next; + } + + state->extra.pointers[0] = listObject; - objects[0] = (*listObject)->object; - *listObject = (*listObject)->next; - return 1; + return count_; } - (OFEnumerator*)objectEnumerator { return [[[OFListEnumerator alloc]