@@ -57,37 +57,32 @@ [object retain]; _mutations++; } -- (void)insertObject: (id)object - atIndex: (size_t)idx +- (void)insertObject: (id)object atIndex: (size_t)idx { if (object == nil) @throw [OFInvalidArgumentException exception]; @try { - [_array insertItem: &object - atIndex: idx]; + [_array insertItem: &object atIndex: idx]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } [object retain]; _mutations++; } -- (void)insertObjectsFromArray: (OFArray *)array - atIndex: (size_t)idx +- (void)insertObjectsFromArray: (OFArray *)array atIndex: (size_t)idx { id const *objects = array.objects; size_t count = array.count; @try { - [_array insertItems: objects - atIndex: idx - count: count]; + [_array insertItems: objects atIndex: idx count: count]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } for (size_t i = 0; i < count; i++) @@ -94,12 +89,11 @@ [objects[i] retain]; _mutations++; } -- (void)replaceObject: (id)oldObject - withObject: (id)newObject +- (void)replaceObject: (id)oldObject withObject: (id)newObject { id *objects; size_t count; if (oldObject == nil || newObject == nil) @@ -117,12 +111,11 @@ return; } } } -- (void)replaceObjectAtIndex: (size_t)idx - withObject: (id)object +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { id *objects; id oldObject; if (object == nil) @@ -136,12 +129,11 @@ oldObject = objects[idx]; objects[idx] = [object retain]; [oldObject release]; } -- (void)replaceObjectIdenticalTo: (id)oldObject - withObject: (id)newObject +- (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject { id *objects; size_t count; if (oldObject == nil || newObject == nil) @@ -229,31 +221,31 @@ [objects[i] release]; [_array removeAllItems]; } -- (void)removeObjectsInRange: (of_range_t)range +- (void)removeObjectsInRange: (OFRange)range { id const *objects = _array.items; size_t count = _array.count; id *copy; if (range.length > SIZE_MAX - range.location || range.location >= count || range.length > count - range.location) @throw [OFOutOfRangeException exception]; - copy = of_alloc(range.length, sizeof(*copy)); + copy = OFAllocMemory(range.length, sizeof(*copy)); memcpy(copy, objects + range.location, range.length * sizeof(id)); @try { [_array removeItemsInRange: range]; _mutations++; for (size_t i = 0; i < range.length; i++) [copy[i] release]; } @finally { - free(copy); + OFFreeMemory(copy); } } - (void)removeLastObject { @@ -270,12 +262,11 @@ _mutations++; #endif } -- (void)exchangeObjectAtIndex: (size_t)idx1 - withObjectAtIndex: (size_t)idx2 +- (void)exchangeObjectAtIndex: (size_t)idx1 withObjectAtIndex: (size_t)idx2 { id *objects = _array.mutableItems; size_t count = _array.count; id tmp; @@ -300,11 +291,11 @@ objects[i] = objects[j]; objects[j] = tmp; } } -- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state +- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count_ { size_t count = _array.count; @@ -337,11 +328,11 @@ initWithArray: self mutationsPtr: &_mutations] autorelease]; } #ifdef OF_HAVE_BLOCKS -- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block +- (void)enumerateObjectsUsingBlock: (OFArrayEnumerationBlock)block { id const *objects = _array.items; size_t count = _array.count; bool stop = false; unsigned long mutations = _mutations; @@ -353,11 +344,11 @@ block(objects[i], i, &stop); } } -- (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block +- (void)replaceObjectsUsingBlock: (OFArrayReplaceBlock)block { id *objects = _array.mutableItems; size_t count = _array.count; unsigned long mutations = _mutations;