@@ -19,30 +19,31 @@ #import "OFObject.h" #import "OFObject+Serialization.h" #import "OFSerialization.h" #import "OFString.h" #import "OFXMLElement.h" -#import "OFAutoreleasePool.h" #import "OFNotImplementedException.h" + +#import "autorelease.h" int _OFObject_Serialization_reference; @implementation OFObject (Serialization) - (OFString*)stringBySerializing { - OFAutoreleasePool *pool; + void *pool; OFXMLElement *element; OFXMLElement *root; OFString *ret; if (![self conformsToProtocol: @protocol(OFSerialization)]) @throw [OFNotImplementedException exceptionWithClass: [self class] selector: @selector(stringBySerializing)]; - pool = [[OFAutoreleasePool alloc] init]; + pool = objc_autoreleasePoolPush(); element = [(id)self XMLElementBySerializing]; root = [OFXMLElement elementWithName: @"serialization" namespace: OF_SERIALIZATION_NS]; [root addAttributeWithName: @"version" @@ -51,11 +52,11 @@ ret = [@"\n" stringByAppendingString: [root XMLStringWithIndentation: 2]]; [ret retain]; - [pool release]; - [ret autorelease]; + + objc_autoreleasePoolPop(pool); - return ret; + return [ret autorelease]; } @end