@@ -24,19 +24,19 @@ #import "OFString.h" #import "OFFile.h" #import "OFURL.h" #import "OFHTTPRequest.h" #import "OFXMLElement.h" -#import "OFAutoreleasePool.h" #import "OFHTTPRequestFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFNotImplementedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" +#import "autorelease.h" #import "base64.h" #import "macros.h" /* References for static linking */ void _references_to_categories_of_OFDataArray(void) @@ -129,23 +129,23 @@ return self; } - initWithContentsOfURL: (OFURL*)URL { - OFAutoreleasePool *pool; + void *pool; OFHTTPRequest *request; OFHTTPRequestResult *result; Class c; c = [self class]; [self release]; - pool = [[OFAutoreleasePool alloc] init]; + pool = objc_autoreleasePoolPush(); if ([[URL scheme] isEqual: @"file"]) { self = [[c alloc] initWithContentsOfFile: [URL path]]; - [pool release]; + objc_autoreleasePoolPop(pool); return self; } request = [OFHTTPRequest requestWithURL: URL]; result = [request perform]; @@ -155,11 +155,11 @@ exceptionWithClass: [request class] HTTPRequest: request result: result]; self = [[result data] retain]; - [pool release]; + objc_autoreleasePoolPop(pool); return self; } - initWithBase64EncodedString: (OFString*)string { @@ -183,11 +183,11 @@ self = [super init]; itemSize = 1; @try { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFString *stringValue; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException @@ -201,11 +201,11 @@ [stringValue cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII])) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; - [pool release]; + objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } @@ -446,29 +446,29 @@ } } - (OFXMLElement*)XMLElementBySerializing { - OFAutoreleasePool *pool; + void *pool; OFXMLElement *element; if (itemSize != 1) @throw [OFNotImplementedException exceptionWithClass: [self class] selector: _cmd]; - pool = [[OFAutoreleasePool alloc] init]; + pool = objc_autoreleasePoolPush(); element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS stringValue: of_base64_encode(data, count * itemSize)]; [element retain]; - [pool release]; - [element autorelease]; + + objc_autoreleasePoolPop(pool); - return element; + return [element autorelease]; } @end @implementation OFBigDataArray - (void)addItem: (const void*)item