Index: src/OFArray.h
==================================================================
--- src/OFArray.h
+++ src/OFArray.h
@@ -85,12 +85,12 @@
*
* \param objects A C array of objects
* \param length The length of the C array
* \return A new autoreleased OFArray
*/
-+ arrayWithCArray: (id*)objects
- length: (size_t)length;
++ arrayWithObjects: (id*)objects
+ count: (size_t)count;
/**
* \brief Initializes an OFArray with the specified object.
*
* \param object An object
@@ -130,12 +130,12 @@
*
* \param objects A C array of objects
* \param length The length of the C array
* \return An initialized OFArray
*/
-- initWithCArray: (id*)objects
- length: (size_t)length;
+- initWithObjects: (id*)objects
+ count: (size_t)count;
/**
* \brief Returns a specified object of the array.
*
* The returned object is not retained and autoreleased for performance
@@ -158,11 +158,11 @@
/**
* \brief Returns the objects of the array as a C array.
*
* \return The objects of the array as a C array
*/
-- (id*)cArray;
+- (id*)objects;
/**
* \brief Returns the index of the first object that is equivalent to the
* specified object or OF_INVALID_INDEX if it was not found.
*
Index: src/OFArray.m
==================================================================
--- src/OFArray.m
+++ src/OFArray.m
@@ -73,15 +73,15 @@
- initWithArray: (OFArray*)array
{
return (id)[[OFArray_adjacent alloc] initWithArray: array];
}
-- initWithCArray: (id*)objects
- length: (size_t)length
+- initWithObjects: (id*)objects
+ count: (size_t)count
{
- return (id)[[OFArray_adjacent alloc] initWithCArray: objects
- length: length];
+ return (id)[[OFArray_adjacent alloc] initWithObjects: objects
+ count: count];
}
- initWithSerialization: (OFXMLElement*)element
{
return (id)[[OFArray_adjacent alloc] initWithSerialization: element];
@@ -150,15 +150,15 @@
+ arrayWithArray: (OFArray*)array
{
return [[[self alloc] initWithArray: array] autorelease];
}
-+ arrayWithCArray: (id*)objects
- length: (size_t)length
++ arrayWithObjects: (id*)objects
+ count: (size_t)count
{
- return [[[self alloc] initWithCArray: objects
- length: length] autorelease];
+ return [[[self alloc] initWithObjects: objects
+ count: count] autorelease];
}
- init
{
if (isa == [OFArray class]) {
@@ -204,12 +204,12 @@
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
-- initWithCArray: (id*)objects
- length: (size_t)length
+- initWithObjects: (id*)objects
+ count: (size_t)count
{
Class c = isa;
[self release];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
@@ -236,11 +236,11 @@
for (i = 0; i < range.length; i++)
buffer[i] = [self objectAtIndex: range.start + i];
}
-- (id*)cArray
+- (id*)objects
{
OFObject *container;
size_t count;
id *buffer;
@@ -335,12 +335,12 @@
@try {
[self getObjects: buffer
inRange: range];
- ret = [OFArray arrayWithCArray: buffer
- length: range.length];
+ ret = [OFArray arrayWithObjects: buffer
+ count: range.length];
} @finally {
[self freeMemory: buffer];
}
return ret;
@@ -355,11 +355,11 @@
- (OFString*)componentsJoinedByString: (OFString*)separator
usingSelector: (SEL)selector
{
OFAutoreleasePool *pool, *pool2;
OFMutableString *ret;
- id *cArray;
+ id *objects;
size_t i, count = [self count];
IMP append;
if (count == 0)
return @"";
@@ -368,23 +368,23 @@
ret = [OFMutableString string];
append = [ret methodForSelector: @selector(appendString:)];
pool = [[OFAutoreleasePool alloc] init];
- cArray = [self cArray];
+ objects = [self objects];
pool2 = [[OFAutoreleasePool alloc] init];
for (i = 0; i < count - 1; i++) {
append(ret, @selector(appendString:),
- [cArray[i] performSelector: selector]);
+ [objects[i] performSelector: selector]);
append(ret, @selector(appendString:), separator);
[pool2 releaseObjects];
}
append(ret, @selector(appendString:),
- [cArray[i] performSelector: selector]);
+ [objects[i] performSelector: selector]);
[ret makeImmutable];
[pool release];
@@ -415,18 +415,18 @@
return YES;
}
- (uint32_t)hash
{
- id *cArray = [self cArray];
+ id *objects = [self objects];
size_t i, count = [self count];
uint32_t hash;
OF_HASH_INIT(hash);
for (i = 0; i < count; i++) {
- uint32_t h = [cArray[i] hash];
+ uint32_t h = [objects[i] hash];
OF_HASH_ADD(hash, h >> 24);
OF_HASH_ADD(hash, (h >> 16) & 0xFF);
OF_HASH_ADD(hash, (h >> 8) & 0xFF);
OF_HASH_ADD(hash, h & 0xFF);
@@ -469,11 +469,11 @@
- (OFXMLElement*)XMLElementBySerializing
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFAutoreleasePool *pool2;
OFXMLElement *element;
- id *cArray = [self cArray];
+ id *objects = [self objects];
size_t i, count = [self count];
if ([self isKindOfClass: [OFMutableArray class]])
element = [OFXMLElement elementWithName: @"OFMutableArray"
namespace: OF_SERIALIZATION_NS];
@@ -482,11 +482,11 @@
namespace: OF_SERIALIZATION_NS];
pool2 = [[OFAutoreleasePool alloc] init];
for (i = 0; i < count; i++) {
- [element addChild: [cArray[i] XMLElementBySerializing]];
+ [element addChild: [objects[i] XMLElementBySerializing]];
[pool2 releaseObjects];
}
[element retain];
@@ -515,27 +515,27 @@
return JSON;
}
- (void)makeObjectsPerformSelector: (SEL)selector
{
- id *cArray = [self cArray];
+ id *objects = [self objects];
size_t i, count = [self count];
for (i = 0; i < count; i++)
- ((void(*)(id, SEL))[cArray[i]
- methodForSelector: selector])(cArray[i], selector);
+ ((void(*)(id, SEL))[objects[i]
+ methodForSelector: selector])(objects[i], selector);
}
- (void)makeObjectsPerformSelector: (SEL)selector
withObject: (id)object
{
- id *cArray = [self cArray];
+ id *objects = [self objects];
size_t i, count = [self count];
for (i = 0; i < count; i++)
- ((void(*)(id, SEL, id))[cArray[i]
- methodForSelector: selector])(cArray[i], selector, object);
+ ((void(*)(id, SEL, id))[objects[i]
+ methodForSelector: selector])(objects[i], selector, object);
}
- (OFArray*)sortedArray
{
OFMutableArray *new = [[self mutableCopy] autorelease];
@@ -570,11 +570,11 @@
if (state->state >= count)
return 0;
state->state = count;
- state->itemsPtr = [self cArray];
+ state->itemsPtr = [self objects];
state->mutationsPtr = (unsigned long*)self;
return (int)count;
}
@@ -611,12 +611,12 @@
[self enumerateObjectsUsingBlock: ^ (id object, size_t index,
BOOL *stop) {
tmp[index] = block(object, index);
}];
- ret = [OFArray arrayWithCArray: tmp
- length: count];
+ ret = [OFArray arrayWithObjects: tmp
+ count: count];
} @finally {
[self freeMemory: tmp];
}
return ret;
@@ -636,12 +636,12 @@
BOOL *stop) {
if (block(object, index))
tmp[i++] = object;
}];
- ret = [OFArray arrayWithCArray: tmp
- length: i];
+ ret = [OFArray arrayWithObjects: tmp
+ count: i];
} @finally {
[self freeMemory: tmp];
}
return ret;
Index: src/OFArray_adjacent.m
==================================================================
--- src/OFArray_adjacent.m
+++ src/OFArray_adjacent.m
@@ -85,32 +85,32 @@
return self;
}
- initWithArray: (OFArray*)array_
{
- id *cArray;
+ id *objects;
size_t i, count;
self = [self init];
@try {
- cArray = [array_ cArray];
+ objects = [array_ objects];
count = [array_ count];
} @catch (id e) {
[self release];
@throw e;
}
@try {
for (i = 0; i < count; i++)
- [cArray[i] retain];
+ [objects[i] retain];
[array addNItems: count
- fromCArray: cArray];
+ fromCArray: objects];
} @catch (id e) {
for (i = 0; i < count; i++)
- [cArray[i] release];
+ [objects[i] release];
/* Prevent double-release of objects */
[array release];
array = nil;
@@ -119,27 +119,27 @@
}
return self;
}
-- initWithCArray: (id*)objects
- length: (size_t)length
+- initWithObjects: (id*)objects
+ count: (size_t)count
{
self = [self init];
@try {
size_t i;
- for (i = 0; i < length; i++)
+ for (i = 0; i < count; i++)
[objects[i] retain];
- [array addNItems: length
+ [array addNItems: count
fromCArray: objects];
} @catch (id e) {
size_t i;
- for (i = 0; i < length; i++)
+ for (i = 0; i < count; i++)
[objects[i] release];
[self release];
@throw e;
}
@@ -189,11 +189,11 @@
- (size_t)count
{
return [array count];
}
-- (id*)cArray
+- (id*)objects
{
return [array cArray];
}
- (id)objectAtIndex: (size_t)index
@@ -202,39 +202,39 @@
}
- (void)getObjects: (id*)buffer
inRange: (of_range_t)range
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
if (range.start + range.length > count)
@throw [OFOutOfRangeException exceptionWithClass: isa];
for (i = 0; i < range.length; i++)
- buffer[i] = cArray[range.start + i];
+ buffer[i] = objects[range.start + i];
}
- (size_t)indexOfObject: (id)object
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
- if ([cArray[i] isEqual: object])
+ if ([objects[i] isEqual: object])
return i;
return OF_INVALID_INDEX;
}
- (size_t)indexOfObjectIdenticalTo: (id)object
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
- if (cArray[i] == object)
+ if (objects[i] == object)
return i;
return OF_INVALID_INDEX;
}
@@ -250,18 +250,18 @@
count = [array count];
if (range.start + range.length > count)
@throw [OFOutOfRangeException exceptionWithClass: isa];
- return [OFArray arrayWithCArray: (id*)[array cArray] + range.start
- length: range.length];
+ return [OFArray arrayWithObjects: (id*)[array cArray] + range.start
+ count: range.length];
}
- (BOOL)isEqual: (id)object
{
OFArray *otherArray;
- id *cArray, *otherCArray;
+ id *objects, *otherObjects;
size_t i, count;
if ([object class] != [OFArray_adjacent class] &&
[object class] != [OFMutableArray_adjacent class] &&
[object class] != [OFArray_adjacentSubarray class])
@@ -272,30 +272,30 @@
count = [array count];
if (count != [otherArray count])
return NO;
- cArray = [array cArray];
- otherCArray = [otherArray cArray];
+ objects = [array cArray];
+ otherObjects = [otherArray objects];
for (i = 0; i < count; i++)
- if (![cArray[i] isEqual: otherCArray[i]])
+ if (![objects[i] isEqual: otherObjects[i]])
return NO;
return YES;
}
- (uint32_t)hash
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
uint32_t hash;
OF_HASH_INIT(hash);
for (i = 0; i < count; i++) {
- uint32_t h = [cArray[i] hash];
+ uint32_t h = [objects[i] hash];
OF_HASH_ADD(hash, h >> 24);
OF_HASH_ADD(hash, (h >> 16) & 0xFF);
OF_HASH_ADD(hash, (h >> 8) & 0xFF);
OF_HASH_ADD(hash, h & 0xFF);
@@ -307,27 +307,27 @@
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
BOOL stop = NO;
for (i = 0; i < count && !stop; i++)
- block(cArray[i], i, &stop);
+ block(objects[i], i, &stop);
}
#endif
- (void)dealloc
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
- [cArray[i] release];
+ [objects[i] release];
[array release];
[super dealloc];
}
@end
Index: src/OFArray_adjacentSubarray.m
==================================================================
--- src/OFArray_adjacentSubarray.m
+++ src/OFArray_adjacentSubarray.m
@@ -19,19 +19,19 @@
#import "OFArray_adjacentSubarray.h"
#import "OFArray_adjacent.h"
#import "OFMutableArray_adjacent.h"
@implementation OFArray_adjacentSubarray
-- (id*)cArray
+- (id*)objects
{
- return [array cArray] + range.start;
+ return [array objects] + range.start;
}
- (BOOL)isEqual: (id)object
{
OFArray *otherArray;
- id *cArray, *otherCArray;
+ id *objects, *otherObjects;
size_t i;
if ([object class] != [OFArray_adjacent class] &&
[object class] != [OFMutableArray_adjacent class] &&
[object class] != [OFArray_adjacentSubarray class])
@@ -40,27 +40,27 @@
otherArray = object;
if (range.length != [otherArray count])
return NO;
- cArray = [self cArray];
- otherCArray = [otherArray cArray];
+ objects = [self objects];
+ otherObjects = [otherArray objects];
for (i = 0; i < range.length; i++)
- if (![cArray[i] isEqual: otherCArray[i]])
+ if (![objects[i] isEqual: otherObjects[i]])
return NO;
return YES;
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block
{
- id *cArray = [self cArray];
+ id *objects = [self objects];
size_t i;
BOOL stop = NO;
for (i = 0; i < range.length && !stop; i++)
- block(cArray[i], i, &stop);
+ block(objects[i], i, &stop);
}
#endif
@end
Index: src/OFCountedSet_hashtable.m
==================================================================
--- src/OFCountedSet_hashtable.m
+++ src/OFCountedSet_hashtable.m
@@ -79,15 +79,15 @@
- initWithArray: (OFArray*)array
{
self = [self init];
@try {
- id *cArray = [array cArray];
+ id *objects = [array objects];
size_t i, count = [array count];
for (i = 0; i < count; i++)
- [self addObject: cArray[i]];
+ [self addObject: objects[i]];
} @catch (id e) {
[self release];
@throw e;
}
Index: src/OFDictionary.m
==================================================================
--- src/OFDictionary.m
+++ src/OFDictionary.m
@@ -311,62 +311,62 @@
}
- (OFArray*)allKeys
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
- id *cArray = [self allocMemoryForNItems: [self count]
- ofSize: sizeof(id)];
+ id *keys = [self allocMemoryForNItems: [self count]
+ ofSize: sizeof(id)];
OFArray *ret;
OFEnumerator *enumerator;
id key;
size_t i = 0;
pool = [[OFAutoreleasePool alloc] init];
enumerator = [self keyEnumerator];
while ((key = [enumerator nextObject]) != nil)
- cArray[i++] = key;
+ keys[i++] = key;
assert(i == [self count]);
[pool release];
@try {
- ret = [OFArray arrayWithCArray: cArray
- length: [self count]];
+ ret = [OFArray arrayWithObjects: keys
+ count: [self count]];
} @finally {
- [self freeMemory: cArray];
+ [self freeMemory: keys];
}
return ret;
}
- (OFArray*)allObjects
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
- id *cArray = [self allocMemoryForNItems: [self count]
- ofSize: sizeof(id)];
+ id *objects = [self allocMemoryForNItems: [self count]
+ ofSize: sizeof(id)];
OFArray *ret;
OFEnumerator *enumerator;
id object;
size_t i = 0;
pool = [[OFAutoreleasePool alloc] init];
enumerator = [self objectEnumerator];
while ((object = [enumerator nextObject]) != nil)
- cArray[i++] = object;
+ objects[i++] = object;
assert(i == [self count]);
[pool release];
@try {
- ret = [OFArray arrayWithCArray: cArray
- length: [self count]];
+ ret = [OFArray arrayWithObjects: objects
+ count: [self count]];
} @finally {
- [self freeMemory: cArray];
+ [self freeMemory: objects];
}
return ret;
}
Index: src/OFDictionary_hashtable.m
==================================================================
--- src/OFDictionary_hashtable.m
+++ src/OFDictionary_hashtable.m
@@ -239,12 +239,12 @@
@try {
id *objectsCArray, *keysCArray;
uint32_t i, j, newSize;
- keysCArray = [keys cArray];
- objectsCArray = [objects cArray];
+ keysCArray = [keys objects];
+ objectsCArray = [objects objects];
count = [keys count];
if (count > UINT32_MAX)
@throw [OFOutOfRangeException exceptionWithClass: isa];
@@ -628,48 +628,48 @@
}
- (OFArray*)allKeys
{
OFArray *ret;
- id *cArray = [self allocMemoryForNItems: count
- ofSize: sizeof(id)];
+ id *keys = [self allocMemoryForNItems: count
+ ofSize: sizeof(id)];
size_t i, j;
for (i = j = 0; i < size; i++)
if (data[i] != NULL && data[i] != DELETED)
- cArray[j++] = data[i]->key;
+ keys[j++] = data[i]->key;
assert(j == count);
@try {
- ret = [OFArray arrayWithCArray: cArray
- length: count];
+ ret = [OFArray arrayWithObjects: keys
+ count: count];
} @finally {
- [self freeMemory: cArray];
+ [self freeMemory: keys];
}
return ret;
}
- (OFArray*)allObjects
{
OFArray *ret;
- id *cArray = [self allocMemoryForNItems: count
- ofSize: sizeof(id)];
+ id *objects = [self allocMemoryForNItems: count
+ ofSize: sizeof(id)];
size_t i, j;
for (i = j = 0; i < size; i++)
if (data[i] != NULL && data[i] != DELETED)
- cArray[j++] = data[i]->object;
+ objects[j++] = data[i]->object;
assert(j == count);
@try {
- ret = [OFArray arrayWithCArray: cArray
- length: count];
+ ret = [OFArray arrayWithObjects: objects
+ count: count];
} @finally {
- [self freeMemory: cArray];
+ [self freeMemory: objects];
}
return ret;
}
Index: src/OFMutableArray.m
==================================================================
--- src/OFMutableArray.m
+++ src/OFMutableArray.m
@@ -106,15 +106,15 @@
- initWithArray: (OFArray*)array
{
return (id)[[OFMutableArray_adjacent alloc] initWithArray: array];
}
-- initWithCArray: (id*)objects
- length: (size_t)length
+- initWithObjects: (id*)objects
+ count: (size_t)count
{
- return (id)[[OFMutableArray_adjacent alloc] initWithCArray: objects
- length: length];
+ return (id)[[OFMutableArray_adjacent alloc] initWithObjects: objects
+ count: count];
}
- initWithSerialization: (OFXMLElement*)element
{
return (id)[[OFMutableArray_adjacent alloc]
Index: src/OFMutableArray_adjacent.m
==================================================================
--- src/OFMutableArray_adjacent.m
+++ src/OFMutableArray_adjacent.m
@@ -53,63 +53,63 @@
}
- (void)replaceObject: (id)oldObject
withObject: (id)newObject
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++) {
- if ([cArray[i] isEqual: oldObject]) {
+ if ([objects[i] isEqual: oldObject]) {
[newObject retain];
- [cArray[i] release];
- cArray[i] = newObject;
+ [objects[i] release];
+ objects[i] = newObject;
return;
}
}
}
- (void)replaceObjectAtIndex: (size_t)index
withObject: (id)object
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
id oldObject;
if (index >= [array count])
@throw [OFOutOfRangeException exceptionWithClass: isa];
- oldObject = cArray[index];
- cArray[index] = [object retain];
+ oldObject = objects[index];
+ objects[index] = [object retain];
[oldObject release];
}
- (void)replaceObjectIdenticalTo: (id)oldObject
withObject: (id)newObject
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++) {
- if (cArray[i] == oldObject) {
+ if (objects[i] == oldObject) {
[newObject retain];
- [cArray[i] release];
- cArray[i] = newObject;
+ [objects[i] release];
+ objects[i] = newObject;
return;
}
}
}
- (void)removeObject: (id)object
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++) {
- if ([cArray[i] isEqual: object]) {
- object = cArray[i];
+ if ([objects[i] isEqual: object]) {
+ object = objects[i];
[array removeItemAtIndex: i];
mutations++;
[object release];
@@ -119,15 +119,15 @@
}
}
- (void)removeObjectIdenticalTo: (id)object
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++) {
- if (cArray[i] == object) {
+ if (objects[i] == object) {
[array removeItemAtIndex: i];
mutations++;
[object release];
@@ -145,19 +145,19 @@
mutations++;
}
- (void)removeNObjects: (size_t)nObjects
{
- id *cArray = [array cArray], *copy;
+ id *objects = [array cArray], *copy;
size_t i, count = [array count];
if (nObjects > count)
@throw [OFOutOfRangeException exceptionWithClass: isa];
copy = [self allocMemoryForNItems: nObjects
ofSize: sizeof(id)];
- memcpy(copy, cArray + (count - nObjects), nObjects * sizeof(id));
+ memcpy(copy, objects + (count - nObjects), nObjects * sizeof(id));
@try {
[array removeNItems: nObjects];
mutations++;
@@ -168,30 +168,30 @@
}
}
- (void)removeAllObjects
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
- [cArray[i] release];
+ [objects[i] release];
[array removeAllItems];
}
- (void)removeObjectsInRange: (of_range_t)range
{
- id *cArray = [array cArray], *copy;
+ id *objects = [array cArray], *copy;
size_t i, count = [array count];
if (range.length > count - range.start)
@throw [OFOutOfRangeException exceptionWithClass: isa];
copy = [self allocMemoryForNItems: range.length
ofSize: sizeof(id)];
- memcpy(copy, cArray + range.start, range.length * sizeof(id));
+ memcpy(copy, objects + range.start, range.length * sizeof(id));
@try {
[array removeNItems: range.length
atIndex: range.start];
mutations++;
@@ -213,34 +213,34 @@
}
- (void)swapObjectAtIndex: (size_t)index1
withObjectAtIndex: (size_t)index2
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t count = [array count];
id tmp;
if (index1 >= count || index2 >= count)
@throw [OFOutOfRangeException exceptionWithClass: isa];
- tmp = cArray[index1];
- cArray[index1] = cArray[index2];
- cArray[index2] = tmp;
+ tmp = objects[index1];
+ objects[index1] = objects[index2];
+ objects[index2] = tmp;
}
- (void)reverse
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, j, count = [array count];
if (count == 0 || count == 1)
return;
for (i = 0, j = count - 1; i < j; i++, j--) {
- id tmp = cArray[i];
- cArray[i] = cArray[j];
- cArray[j] = tmp;
+ id tmp = objects[i];
+ objects[i] = objects[j];
+ objects[j] = tmp;
}
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
@@ -268,11 +268,11 @@
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
BOOL stop = NO;
unsigned long mutations2 = mutations;
for (i = 0; i < count && !stop; i++) {
@@ -279,17 +279,17 @@
if (mutations != mutations2)
@throw [OFEnumerationMutationException
exceptionWithClass: isa
object: self];
- block(cArray[i], i, &stop);
+ block(objects[i], i, &stop);
}
}
- (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block
{
- id *cArray = [array cArray];
+ id *objects = [array cArray];
size_t i, count = [array count];
BOOL stop = NO;
unsigned long mutations2 = mutations;
for (i = 0; i < count && !stop; i++) {
@@ -298,24 +298,24 @@
if (mutations != mutations2)
@throw [OFEnumerationMutationException
exceptionWithClass: isa
object: self];
- newObject = block(cArray[i], i, &stop);
+ newObject = block(objects[i], i, &stop);
if (newObject == nil)
@throw [OFInvalidArgumentException
exceptionWithClass: isa
selector: _cmd];
[newObject retain];
- [cArray[i] release];
- cArray[i] = newObject;
+ [objects[i] release];
+ objects[i] = newObject;
}
}
#endif
- (void)makeImmutable
{
isa = [OFArray_adjacent class];
}
@end
Index: src/OFProcess.m
==================================================================
--- src/OFProcess.m
+++ src/OFProcess.m
@@ -85,11 +85,11 @@
@throw [OFInitializationFailedException
exceptionWithClass: isa];
switch ((pid = fork())) {
case 0:;
- OFString **cArray = [arguments cArray];
+ OFString **objects = [arguments objects];
size_t i, count = [arguments count];
char **argv;
argv = [self allocMemoryForNItems: count + 2
ofSize: sizeof(char*)];
@@ -96,11 +96,11 @@
argv[0] = (char*)[programName cStringWithEncoding:
OF_STRING_ENCODING_NATIVE];
for (i = 0; i < count; i++)
- argv[i + 1] = (char*)[cArray[i]
+ argv[i + 1] = (char*)[objects[i]
cStringWithEncoding:
OF_STRING_ENCODING_NATIVE];
argv[i + 1] = NULL;
Index: src/OFSet_hashtable.m
==================================================================
--- src/OFSet_hashtable.m
+++ src/OFSet_hashtable.m
@@ -78,16 +78,16 @@
self = [self init];
@try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFNumber *one = [OFNumber numberWithSize: 1];
- id *cArray = [array cArray];
+ id *objects = [array objects];
size_t i, count = [array count];
for (i = 0; i < count; i++)
[dictionary _setObject: one
- forKey: cArray[i]
+ forKey: objects[i]
copyKey: NO];
[pool release];
} @catch (id e) {
[self release];
Index: src/OFStreamObserver.m
==================================================================
--- src/OFStreamObserver.m
+++ src/OFStreamObserver.m
@@ -295,17 +295,17 @@
- (void)_processQueue
{
[mutex lock];
@try {
- OFStream **queueCArray = [queue cArray];
+ OFStream **queueObjects = [queue objects];
int *queueInfoCArray = [queueInfo cArray];
int *queueFDsCArray = [queueFDs cArray];
size_t i, count = [queue count];
for (i = 0; i < count; i++) {
- OFStream *stream = queueCArray[i];
+ OFStream *stream = queueObjects[i];
int action = queueInfoCArray[i];
int fd = queueFDsCArray[i];
if ((action & QUEUE_ACTION) == QUEUE_ADD) {
if (fd > maxFD) {
@@ -374,20 +374,20 @@
}
- (BOOL)_processCache
{
OFAutoreleasePool *pool;
- OFStream **cArray = [readStreams cArray];
+ OFStream **objects = [readStreams objects];
size_t i, count = [readStreams count];
BOOL foundInCache = NO;
pool = [[OFAutoreleasePool alloc] init];
for (i = 0; i < count; i++) {
- if ([cArray[i] pendingBytes] > 0 &&
- ![cArray[i] _isWaitingForDelimiter]) {
- [delegate streamIsReadyForReading: cArray[i]];
+ if ([objects[i] pendingBytes] > 0 &&
+ ![objects[i] _isWaitingForDelimiter]) {
+ [delegate streamIsReadyForReading: objects[i]];
foundInCache = YES;
[pool releaseObjects];
}
}
Index: src/OFStreamObserver_select.m
==================================================================
--- src/OFStreamObserver_select.m
+++ src/OFStreamObserver_select.m
@@ -69,11 +69,11 @@
}
- (BOOL)observeWithTimeout: (int)timeout
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
- OFStream **cArray;
+ OFStream **objects;
fd_set readFDs_;
fd_set writeFDs_;
fd_set exceptFDs_;
struct timeval time;
size_t i, count;
@@ -111,23 +111,23 @@
#else
assert(recvfrom(cancelFD[0], &buffer, 1, 0, NULL, NULL) > 0);
#endif
}
- cArray = [readStreams cArray];
+ objects = [readStreams objects];
count = [readStreams count];
for (i = 0; i < count; i++) {
- int fileDescriptor = [cArray[i] fileDescriptor];
+ int fileDescriptor = [objects[i] fileDescriptor];
if (FD_ISSET(fileDescriptor, &readFDs_)) {
- [delegate streamIsReadyForReading: cArray[i]];
+ [delegate streamIsReadyForReading: objects[i]];
[pool releaseObjects];
}
if (FD_ISSET(fileDescriptor, &exceptFDs_)) {
- [delegate streamDidReceiveException: cArray[i]];
+ [delegate streamDidReceiveException: objects[i]];
[pool releaseObjects];
/*
* Prevent calling it twice in case the FD is in both
* sets.
@@ -134,27 +134,27 @@
*/
FD_CLR(fileDescriptor, &exceptFDs_);
}
}
- cArray = [writeStreams cArray];
+ objects = [writeStreams objects];
count = [writeStreams count];
for (i = 0; i < count; i++) {
- int fileDescriptor = [cArray[i] fileDescriptor];
+ int fileDescriptor = [objects[i] fileDescriptor];
if (FD_ISSET(fileDescriptor, &writeFDs_)) {
- [delegate streamIsReadyForWriting: cArray[i]];
+ [delegate streamIsReadyForWriting: objects[i]];
[pool releaseObjects];
}
if (FD_ISSET(fileDescriptor, &exceptFDs_)) {
- [delegate streamDidReceiveException: cArray[i]];
+ [delegate streamDidReceiveException: objects[i]];
[pool releaseObjects];
}
}
[pool release];
return YES;
}
@end
Index: src/OFURL.m
==================================================================
--- src/OFURL.m
+++ src/OFURL.m
@@ -42,24 +42,24 @@
array = [[[path componentsSeparatedByString: @"/"] mutableCopy]
autorelease];
while (!done) {
- id *cArray = [array cArray];
+ id *objects = [array objects];
size_t i, length = [array count];
done = YES;
for (i = 0; i < length; i++) {
- if ([cArray[i] isEqual: @"."]) {
+ if ([objects[i] isEqual: @"."]) {
[array removeObjectAtIndex: i];
done = NO;
break;
}
- if ([cArray[i] isEqual: @".."]) {
+ if ([objects[i] isEqual: @".."]) {
[array removeObjectAtIndex: i];
if (i > 0)
[array removeObjectAtIndex: i - 1];
Index: src/OFXMLElement.m
==================================================================
--- src/OFXMLElement.m
+++ src/OFXMLElement.m
@@ -432,22 +432,22 @@
- (OFString*)stringValue
{
OFAutoreleasePool *pool;
OFMutableString *ret;
- OFXMLElement **cArray;
+ OFXMLElement **objects;
size_t i, count = [children count];
if (count == 0)
return @"";
ret = [OFMutableString string];
- cArray = [children cArray];
+ objects = [children objects];
pool = [[OFAutoreleasePool alloc] init];
for (i = 0; i < count; i++) {
- [ret appendString: [cArray[i] stringValue]];
+ [ret appendString: [objects[i] stringValue]];
[pool releaseObjects];
}
[ret makeImmutable];
@@ -463,11 +463,11 @@
{
OFAutoreleasePool *pool, *pool2;
char *cString;
size_t length, i, j, attributesCount;
OFString *prefix, *parentPrefix;
- OFXMLAttribute **attributesCArray;
+ OFXMLAttribute **attributesObjects;
OFString *ret;
OFString *defaultNS;
pool = [[OFAutoreleasePool alloc] init];
@@ -549,26 +549,26 @@
i += [ns UTF8StringLength];
cString[i++] = '\'';
}
/* Attributes */
- attributesCArray = [attributes cArray];
+ attributesObjects = [attributes objects];
attributesCount = [attributes count];
pool2 = [[OFAutoreleasePool alloc] init];
for (j = 0; j < attributesCount; j++) {
- OFString *attributeName = [attributesCArray[j] name];
+ OFString *attributeName = [attributesObjects[j] name];
OFString *attributePrefix = nil;
OFString *tmp =
- [[attributesCArray[j] stringValue] stringByXMLEscaping];
+ [[attributesObjects[j] stringValue] stringByXMLEscaping];
- if ([attributesCArray[j] namespace] != nil &&
+ if ([attributesObjects[j] namespace] != nil &&
(attributePrefix = [allNamespaces objectForKey:
- [attributesCArray[j] namespace]]) == nil)
+ [attributesObjects[j] namespace]]) == nil)
@throw [OFUnboundNamespaceException
exceptionWithClass: isa
- namespace: [attributesCArray[j]
+ namespace: [attributesObjects[j]
namespace]];
length += [attributeName UTF8StringLength] +
(attributePrefix != nil ?
[attributePrefix UTF8StringLength] + 1 : 0) +
@@ -601,21 +601,22 @@
[pool2 releaseObjects];
}
/* Childen */
if (children != nil) {
- OFXMLElement **childrenCArray = [children cArray];
+ OFXMLElement **childrenObjects = [children objects];
size_t childrenCount = [children count];
OFDataArray *tmp = [OFDataArray dataArray];
BOOL indent;
if (indentation > 0) {
indent = YES;
for (j = 0; j < childrenCount; j++) {
- if (childrenCArray[j]->isa == charactersClass ||
- childrenCArray[j]->isa == CDATAClass) {
+ if ([childrenObjects[j] isKindOfClass:
+ charactersClass] || [childrenObjects[j]
+ isKindOfClass: CDATAClass]) {
indent = NO;
break;
}
}
} else
@@ -626,19 +627,19 @@
unsigned int ind = (indent ? indentation : 0);
if (ind)
[tmp addItem: "\n"];
- if ([childrenCArray[j] isKindOfClass:
+ if ([childrenObjects[j] isKindOfClass:
[OFXMLElement class]])
- child = [childrenCArray[j]
+ child = [childrenObjects[j]
_XMLStringWithParent: self
namespaces: allNamespaces
indentation: ind
level: level + 1];
else
- child = [childrenCArray[j]
+ child = [childrenObjects[j]
XMLStringWithIndentation: ind
level: level + 1];
[tmp addNItems: [child UTF8StringLength]
fromCArray: [child UTF8String]];
@@ -827,49 +828,49 @@
[pool release];
}
- (OFXMLAttribute*)attributeForName: (OFString*)attributeName
{
- OFXMLAttribute **cArray = [attributes cArray];
+ OFXMLAttribute **objects = [attributes objects];
size_t i, count = [attributes count];
for (i = 0; i < count; i++)
- if (cArray[i]->ns == nil &&
- [cArray[i]->name isEqual: attributeName])
- return cArray[i];
+ if (objects[i]->ns == nil &&
+ [objects[i]->name isEqual: attributeName])
+ return objects[i];
return nil;
}
- (OFXMLAttribute*)attributeForName: (OFString*)attributeName
namespace: (OFString*)attributeNS
{
- OFXMLAttribute **cArray;
+ OFXMLAttribute **objects;
size_t i, count;
if (attributeNS == nil)
return [self attributeForName: attributeName];
- cArray = [attributes cArray];
+ objects = [attributes objects];
count = [attributes count];
for (i = 0; i < count; i++)
- if ([cArray[i]->ns isEqual: attributeNS] &&
- [cArray[i]->name isEqual: attributeName])
- return cArray[i];
+ if ([objects[i]->ns isEqual: attributeNS] &&
+ [objects[i]->name isEqual: attributeName])
+ return objects[i];
return nil;
}
- (void)removeAttributeForName: (OFString*)attributeName
{
- OFXMLAttribute **cArray = [attributes cArray];
+ OFXMLAttribute **objects = [attributes objects];
size_t i, count = [attributes count];
for (i = 0; i < count; i++) {
- if (cArray[i]->ns == nil &&
- [cArray[i]->name isEqual: attributeName]) {
+ if (objects[i]->ns == nil &&
+ [objects[i]->name isEqual: attributeName]) {
[attributes removeObjectAtIndex: i];
return;
}
}
@@ -876,22 +877,22 @@
}
- (void)removeAttributeForName: (OFString*)attributeName
namespace: (OFString*)attributeNS
{
- OFXMLAttribute **cArray;
+ OFXMLAttribute **objects;
size_t i, count;
if (attributeNS == nil)
return [self removeAttributeForName: attributeName];
- cArray = [attributes cArray];
+ objects = [attributes objects];
count = [attributes count];
for (i = 0; i < count; i++) {
- if ([cArray[i]->ns isEqual: attributeNS] &&
- [cArray[i]->name isEqual: attributeName]) {
+ if ([objects[i]->ns isEqual: attributeNS] &&
+ [objects[i]->name isEqual: attributeName]) {
[attributes removeObjectAtIndex: i];
return;
}
}
}
@@ -963,50 +964,50 @@
}
- (OFArray*)elements
{
OFMutableArray *ret = [OFMutableArray array];
- OFXMLElement **cArray = [children cArray];
+ OFXMLElement **objects = [children objects];
size_t i, count = [children count];
for (i = 0; i < count; i++)
- if ([cArray[i] isKindOfClass: [OFXMLElement class]])
- [ret addObject: cArray[i]];
+ if ([objects[i] isKindOfClass: [OFXMLElement class]])
+ [ret addObject: objects[i]];
[ret makeImmutable];
return ret;
}
- (OFArray*)elementsForName: (OFString*)elementName
{
OFMutableArray *ret = [OFMutableArray array];
- OFXMLElement **cArray = [children cArray];
+ OFXMLElement **objects = [children objects];
size_t i, count = [children count];
for (i = 0; i < count; i++)
- if ([cArray[i] isKindOfClass: [OFXMLElement class]] &&
- cArray[i]->ns == nil &&
- [cArray[i]->name isEqual: elementName])
- [ret addObject: cArray[i]];
+ if ([objects[i] isKindOfClass: [OFXMLElement class]] &&
+ objects[i]->ns == nil &&
+ [objects[i]->name isEqual: elementName])
+ [ret addObject: objects[i]];
[ret makeImmutable];
return ret;
}
- (OFArray*)elementsForNamespace: (OFString*)elementNS
{
OFMutableArray *ret = [OFMutableArray array];
- OFXMLElement **cArray = [children cArray];
+ OFXMLElement **objects = [children objects];
size_t i, count = [children count];
for (i = 0; i < count; i++)
- if ([cArray[i] isKindOfClass: [OFXMLElement class]] &&
- cArray[i]->name != nil &&
- [cArray[i]->ns isEqual: elementNS])
- [ret addObject: cArray[i]];
+ if ([objects[i] isKindOfClass: [OFXMLElement class]] &&
+ objects[i]->name != nil &&
+ [objects[i]->ns isEqual: elementNS])
+ [ret addObject: objects[i]];
[ret makeImmutable];
return ret;
}
@@ -1013,25 +1014,25 @@
- (OFArray*)elementsForName: (OFString*)elementName
namespace: (OFString*)elementNS
{
OFMutableArray *ret;
- OFXMLElement **cArray;
+ OFXMLElement **objects;
size_t i, count;
if (elementNS == nil)
return [self elementsForName: elementName];
ret = [OFMutableArray array];
- cArray = [children cArray];
+ objects = [children objects];
count = [children count];
for (i = 0; i < count; i++)
- if ([cArray[i] isKindOfClass: [OFXMLElement class]] &&
- [cArray[i]->ns isEqual: elementNS] &&
- [cArray[i]->name isEqual: elementName])
- [ret addObject: cArray[i]];
+ if ([objects[i] isKindOfClass: [OFXMLElement class]] &&
+ [objects[i]->ns isEqual: elementNS] &&
+ [objects[i]->name isEqual: elementName])
+ [ret addObject: objects[i]];
[ret makeImmutable];
return ret;
}
Index: src/OFXMLElementBuilder.m
==================================================================
--- src/OFXMLElementBuilder.m
+++ src/OFXMLElementBuilder.m
@@ -88,30 +88,30 @@
withPrefix: (OFString*)prefix
namespace: (OFString*)ns
attributes: (OFArray*)attributes
{
OFXMLElement *element;
- OFXMLAttribute **cArray;
+ OFXMLAttribute **objects;
size_t i, count;
element = [OFXMLElement elementWithName: name
namespace: ns];
- cArray = [attributes cArray];
+ objects = [attributes objects];
count = [attributes count];
for (i = 0; i < count; i++) {
- if ([cArray[i] namespace] == nil &&
- [[cArray[i] name] isEqual: @"xmlns"])
+ if ([objects[i] namespace] == nil &&
+ [[objects[i] name] isEqual: @"xmlns"])
continue;
- if ([[cArray[i] namespace]
+ if ([[objects[i] namespace]
isEqual: @"http://www.w3.org/2000/xmlns/"])
- [element setPrefix: [cArray[i] name]
- forNamespace: [cArray[i] stringValue]];
+ [element setPrefix: [objects[i] name]
+ forNamespace: [objects[i] stringValue]];
- [element addAttribute: cArray[i]];
+ [element addAttribute: objects[i]];
}
[[stack lastObject] addChild: element];
[stack addObject: element];
}
Index: src/OFXMLParser.m
==================================================================
--- src/OFXMLParser.m
+++ src/OFXMLParser.m
@@ -96,20 +96,20 @@
}
static OFString*
namespace_for_prefix(OFString *prefix, OFArray *namespaces)
{
- OFDictionary **cArray = [namespaces cArray];
+ OFDictionary **objects = [namespaces objects];
ssize_t i;
if (prefix == nil)
prefix = @"";
for (i = [namespaces count] - 1; i >= 0; i--) {
OFString *tmp;
- if ((tmp = [cArray[i] objectForKey: prefix]) != nil)
+ if ((tmp = [objects[i] objectForKey: prefix]) != nil)
return tmp;
}
return nil;
}
@@ -668,11 +668,11 @@
i: (size_t*)i
last: (size_t*)last
{
OFAutoreleasePool *pool;
OFString *ns;
- OFXMLAttribute **attributesCArray;
+ OFXMLAttribute **attributesObjects;
size_t j, attributesCount;
if (buffer[*i] != '>' && buffer[*i] != '/') {
if (buffer[*i] != ' ' && buffer[*i] != '\t' &&
buffer[*i] != '\n' && buffer[*i] != '\r') {
@@ -682,21 +682,21 @@
}
return;
}
- attributesCArray = [attributes cArray];
+ attributesObjects = [attributes objects];
attributesCount = [attributes count];
ns = namespace_for_prefix(prefix, namespaces);
if (prefix != nil && ns == nil)
@throw [OFUnboundNamespaceException exceptionWithClass: isa
prefix: prefix];
for (j = 0; j < attributesCount; j++)
- resolve_attribute_namespace(attributesCArray[j], namespaces,
+ resolve_attribute_namespace(attributesObjects[j], namespaces,
isa);
pool = [[OFAutoreleasePool alloc] init];
[delegate parser: self
Index: tests/OFArrayTests.m
==================================================================
--- tests/OFArrayTests.m
+++ tests/OFArrayTests.m
@@ -27,12 +27,11 @@
static OFString *module = @"OFArray";
static OFString *c_ary[] = {
@"Foo",
@"Bar",
- @"Baz",
- nil
+ @"Baz"
};
@implementation TestsAppDelegate (OFArrayTests)
- (void)arrayTests
{
@@ -47,16 +46,14 @@
TEST(@"+[array]", (m[0] = [OFMutableArray array]))
TEST(@"+[arrayWithObjects:]",
(a[0] = [OFArray arrayWithObjects: @"Foo", @"Bar", @"Baz", nil]))
- TEST(@"+[arrayWithCArray:]", (a[1] = [OFArray arrayWithCArray: c_ary]))
-
- TEST(@"+[arrayWithCArray:length:]",
- (a[2] = [OFArray arrayWithCArray: c_ary
- length: 3]) &&
- [a[2] isEqual: a[1]])
+ TEST(@"+[arrayWithObjects:count:]",
+ (a[1] = [OFArray arrayWithObjects: c_ary
+ count: 3]) &&
+ [a[1] isEqual: a[0]])
TEST(@"-[description]",
[[a[0] description ]isEqual: @"(\n\tFoo,\n\tBar,\n\tBaz\n)"])
TEST(@"-[addObject:]", R([m[0] addObject: c_ary[0]]) &&