@@ -18,14 +18,14 @@ #import "OFXMLAttribute.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" -#import "OFAutoreleasePool.h" #import "OFInvalidArgumentException.h" +#import "autorelease.h" #import "macros.h" @implementation OFXMLAttribute + attributeWithName: (OFString*)name namespace: (OFString*)ns @@ -57,11 +57,11 @@ - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] @@ -72,11 +72,11 @@ ns = [[[element attributeForName: @"namespace"] stringValue] copy]; stringValue = [[[element attributeForName: @"stringValue"] stringValue] copy]; - [pool release]; + objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } @@ -141,11 +141,11 @@ return hash; } - (OFXMLElement*)XMLElementBySerializing { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; @@ -158,18 +158,18 @@ [element addAttributeWithName: @"stringValue" stringValue: stringValue]; [element retain]; - [pool release]; - [element autorelease]; + + objc_autoreleasePoolPop(pool); - return element; + return [element autorelease]; } - (OFString*)description { return [OFString stringWithFormat: @"", name, ns, stringValue]; } @end