@@ -57,17 +57,17 @@ equal(void *object1, void *object2) { return [(id)object1 isEqual: (id)object2]; } -static const of_map_table_functions_t keyFunctions = { +static const OFMapTableFunctions keyFunctions = { .retain = copy, .release = release, .hash = hash, .equal = equal }; -static const of_map_table_functions_t objectFunctions = { +static const OFMapTableFunctions objectFunctions = { .retain = retain, .release = release, .hash = hash, .equal = equal }; @@ -135,12 +135,11 @@ keyEnumerator = [dictionary keyEnumerator]; objectEnumerator = [dictionary objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -147,18 +146,16 @@ } return self; } -- (instancetype)initWithObject: (id)object - forKey: (id)key +- (instancetype)initWithObject: (id)object forKey: (id)key { self = [self initWithCapacity: 1]; @try { - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; } @catch (id e) { [self release]; @throw e; } @@ -173,22 +170,20 @@ @try { size_t i; for (i = 0; i < count; i++) - [_mapTable setObject: objects[i] - forKey: keys[i]]; + [_mapTable setObject: objects[i] forKey: keys[i]]; } @catch (id e) { [self release]; @throw e; } return self; } -- (instancetype)initWithKey: (id)firstKey - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { self = [super init]; @try { va_list argumentsCopy; @@ -216,22 +211,20 @@ _mapTable = [[OFMapTable alloc] initWithKeyFunctions: keyFunctions objectFunctions: objectFunctions capacity: count]; - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; for (i = 1; i < count; i++) { key = va_arg(arguments, id); object = va_arg(arguments, id); if (key == nil || object == nil) @throw [OFInvalidArgumentException exception]; - [_mapTable setObject: object - forKey: key]; + [_mapTable setObject: object forKey: key]; } } @catch (id e) { [self release]; @throw e; } @@ -248,13 +241,13 @@ OFArray *keys, *objects; OFEnumerator *keyEnumerator, *objectEnumerator; OFXMLElement *keyElement, *objectElement; keys = [element elementsForName: @"key" - namespace: OF_SERIALIZATION_NS]; + namespace: OFSerializationNS]; objects = [element elementsForName: @"object" - namespace: OF_SERIALIZATION_NS]; + namespace: OFSerializationNS]; if (keys.count != objects.count) @throw [OFInvalidFormatException exception]; _mapTable = [[OFMapTable alloc] @@ -268,13 +261,13 @@ (objectElement = [objectEnumerator nextObject]) != nil) { void *pool2 = objc_autoreleasePoolPush(); OFXMLElement *key, *object; key = [keyElement elementsForNamespace: - OF_SERIALIZATION_NS].firstObject; + OFSerializationNS].firstObject; object = [objectElement elementsForNamespace: - OF_SERIALIZATION_NS].firstObject; + OFSerializationNS].firstObject; if (key == nil || object == nil) @throw [OFInvalidFormatException exception]; [_mapTable setObject: object.objectByDeserializing @@ -340,11 +333,11 @@ OFArray *ret; id *keys; size_t count; count = _mapTable.count; - keys = of_alloc(count, sizeof(*keys)); + keys = OFAllocMemory(count, sizeof(*keys)); @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **keyPtr; @@ -358,14 +351,13 @@ keys[i++] = (id)*keyPtr; } objc_autoreleasePoolPop(pool); - ret = [OFArray arrayWithObjects: keys - count: count]; + ret = [OFArray arrayWithObjects: keys count: count]; } @finally { - free(keys); + OFFreeMemory(keys); } return ret; } @@ -374,11 +366,11 @@ OFArray *ret; id *objects; size_t count; count = _mapTable.count; - objects = of_alloc(count, sizeof(*objects)); + objects = OFAllocMemory(count, sizeof(*objects)); @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **objectPtr; @@ -392,14 +384,13 @@ objects[i++] = (id)*objectPtr; } objc_autoreleasePoolPop(pool); - ret = [OFArray arrayWithObjects: objects - count: count]; + ret = [OFArray arrayWithObjects: objects count: count]; } @finally { - free(objects); + OFFreeMemory(objects); } return ret; } @@ -415,22 +406,21 @@ return [[[OFMapTableEnumeratorWrapper alloc] initWithEnumerator: [_mapTable objectEnumerator] object: self] autorelease]; } -- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state +- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count { return [_mapTable countByEnumeratingWithState: state objects: objects count: count]; } #ifdef OF_HAVE_BLOCKS -- (void)enumerateKeysAndObjectsUsingBlock: - (of_dictionary_enumeration_block_t)block +- (void)enumerateKeysAndObjectsUsingBlock: (OFDictionaryEnumerationBlock)block { @try { [_mapTable enumerateKeysAndObjectsUsingBlock: ^ (void *key, void *object, bool *stop) { block(key, object, stop);