Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -128,19 +128,19 @@ [_connection handleConnection]; } - (id)main { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [_connection connect]; [self performSelector: @selector(didConnect) onThread: _sourceThread waitUntilDone: false]; - [pool release]; + objc_autoreleasePoolPop(pool); return nil; } @end @@ -316,11 +316,11 @@ [old release]; } - (void)connect { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); XMPPSRVEntry *candidate = nil; XMPPSRVLookup *SRVLookup = nil; OFEnumerator *enumerator; if (_socket != nil) @@ -359,11 +359,11 @@ port: _port]; } [self XMPP_startStream]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (void)handleConnection { char *buffer = [self allocMemoryWithSize: BUFFER_LENGTH]; @@ -375,17 +375,17 @@ exception:)]; } - (void)asyncConnectAndHandle { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [[[[XMPPConnection_ConnectThread alloc] initWithSourceThread: [OFThread currentThread] connection: self] autorelease] start]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (bool)XMPP_parseBuffer: (const void *)buffer length: (size_t)length { @@ -520,16 +520,14 @@ - (void)sendIQ: (XMPPIQ *)IQ callbackTarget: (id)target selector: (SEL)selector { - OFAutoreleasePool *pool; + void *pool = objc_autoreleasePoolPush(); XMPPCallback *callback; OFString *ID, *key; - pool = [[OFAutoreleasePool alloc] init]; - if ((ID = [IQ ID]) == nil) { ID = [self generateStanzaID]; [IQ setID: ID]; } @@ -541,25 +539,24 @@ callback = [XMPPCallback callbackWithTarget: target selector: selector]; [_callbacks setObject: callback forKey: key]; - [pool release]; + + objc_autoreleasePoolPop(pool); [self sendStanza: IQ]; } #ifdef OF_HAVE_BLOCKS - (void)sendIQ: (XMPPIQ *)IQ callbackBlock: (xmpp_callback_block_t)block { - OFAutoreleasePool *pool; + void *pool = objc_autoreleasePoolPush(); XMPPCallback *callback; OFString *ID, *key; - pool = [[OFAutoreleasePool alloc] init]; - if ((ID = [IQ ID]) == nil) { ID = [self generateStanzaID]; [IQ setID: ID]; } @@ -570,11 +567,12 @@ key = [key stringByAppendingString: ID]; callback = [XMPPCallback callbackWithBlock: block]; [_callbacks setObject: callback forKey: key]; - [pool release]; + + objc_autoreleasePoolPop(pool); [self sendStanza: IQ]; } #endif Index: src/XMPPFileStorage.m ================================================================== --- src/XMPPFileStorage.m +++ src/XMPPFileStorage.m @@ -122,117 +122,117 @@ } - (void)setStringValue: (OFString *)string forPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self XMPP_setObject: string forPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (OFString *)stringValueForPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFString *string; string = [self XMPP_objectForPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); return string; } - (void)setBooleanValue: (bool)boolean forPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self XMPP_setObject: [OFNumber numberWithBool: boolean] forPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (bool)booleanValueForPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); bool boolean; boolean = [[self XMPP_objectForPath: path] boolValue]; - [pool release]; + objc_autoreleasePoolPop(pool); return boolean; } - (void)setIntegerValue: (intmax_t)integer forPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self XMPP_setObject: [OFNumber numberWithIntMax: integer] forPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (intmax_t)integerValueForPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); intmax_t integer; integer = [[self XMPP_objectForPath: path] intMaxValue]; - [pool release]; + objc_autoreleasePoolPop(pool); return integer; } - (void)setArray: (OFArray *)array forPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self XMPP_setObject: array forPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (OFArray *)arrayForPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFArray *array; array = [self XMPP_objectForPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); return array; } - (void)setDictionary: (OFDictionary *)dictionary forPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); [self XMPP_setObject: dictionary forPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (OFDictionary *)dictionaryForPath: (OFString *)path { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFDictionary *dictionary; dictionary = [self XMPP_objectForPath: path]; - [pool release]; + objc_autoreleasePoolPop(pool); return dictionary; } @end Index: src/XMPPIQ.m ================================================================== --- src/XMPPIQ.m +++ src/XMPPIQ.m @@ -68,11 +68,11 @@ condition: (OFString *)condition text: (OFString *)text { XMPPIQ *ret = [XMPPIQ IQWithType: @"error" ID: [self ID]]; - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFXMLElement *error = [OFXMLElement elementWithName: @"error" namespace: XMPP_NS_CLIENT]; [error addAttributeWithName: @"type" stringValue: type]; @@ -84,11 +84,11 @@ stringValue: text]]; [ret addChild: error]; [ret setTo: [self from]]; [ret setFrom: nil]; - [pool release]; + objc_autoreleasePoolPop(pool); return ret; } - (XMPPIQ *)errorIQWithType: (OFString *)type Index: src/XMPPMulticastDelegate.m ================================================================== --- src/XMPPMulticastDelegate.m +++ src/XMPPMulticastDelegate.m @@ -72,11 +72,11 @@ } - (bool)broadcastSelector: (SEL)selector withObject: (id)object { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableData *currentDelegates = [[_delegates copy] autorelease]; id *items = [currentDelegates items]; size_t i, count = [currentDelegates count]; bool handled = false; @@ -90,20 +90,20 @@ [responder methodForSelector: selector]; handled |= imp(responder, selector, object); } - [pool release]; + objc_autoreleasePoolPop(pool); return handled; } - (bool)broadcastSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableData *currentDelegates = [[_delegates copy] autorelease]; id *items = [currentDelegates items]; size_t i, count = [currentDelegates count]; bool handled = false; @@ -117,10 +117,10 @@ [responder methodForSelector: selector]; handled |= imp(responder, selector, object1, object2); } - [pool release]; + objc_autoreleasePoolPop(pool); return handled; } @end Index: src/XMPPRoster.m ================================================================== --- src/XMPPRoster.m +++ src/XMPPRoster.m @@ -351,22 +351,22 @@ [_dataStorage setDictionary: nil forPath: @"roster.items"]; } for (OFXMLElement *element in [rosterElement children]) { - OFAutoreleasePool *pool; + void *pool = objc_autoreleasePoolPush(); XMPPRosterItem *rosterItem; if (![[element name] isEqual: @"item"] || ![[element namespace] isEqual: XMPP_NS_ROSTER]) continue; - pool = [[OFAutoreleasePool alloc] init]; rosterItem = [self XMPP_rosterItemWithXMLElement: element]; [self XMPP_updateRosterItem: rosterItem]; - [pool release]; + + objc_autoreleasePoolPop(pool); } if ([connection supportsRosterVersioning] && rosterElement != nil) { OFString *ver = [[rosterElement attributeForName: @"ver"] stringValue]; Index: src/XMPPSCRAMAuth.m ================================================================== --- src/XMPPSCRAMAuth.m +++ src/XMPPSCRAMAuth.m @@ -431,11 +431,11 @@ } - (const uint8_t *)XMPP_HMACWithKey: (OFData *)key data: (OFData *)data { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); OFMutableData *k = [OFMutableData data]; size_t i, kSize, blockSize = [_hashType blockSize]; uint8_t *kI = NULL, *kO = NULL; id hashI, hashO; @@ -478,20 +478,21 @@ [self freeMemory: kI]; [self freeMemory: kO]; } [hashO retain]; - [pool release]; + + objc_autoreleasePoolPop(pool); return [[hashO autorelease] digest]; } - (OFData *)XMPP_hiWithData: (OFData *)str salt: (OFData *)salt iterationCount: (intmax_t)i { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); size_t digestSize = [_hashType digestSize]; uint8_t *result = NULL; const uint8_t *u, *uOld; intmax_t j, k; OFMutableData *salty, *tmp, *ret; @@ -514,11 +515,13 @@ for (j = 0; j < i - 1; j++) { tmp = [[OFMutableData alloc] init]; [tmp addItems: uOld count: digestSize]; - [pool releaseObjects]; // releases uOld and previous tmp + /* releases uOld and previous tmp */ + objc_autoreleasePoolPop(pool); + pool = objc_autoreleasePoolPush(); [tmp autorelease]; u = [self XMPP_HMACWithKey: str data: tmp]; @@ -533,10 +536,11 @@ } @finally { [self freeMemory: result]; } [ret retain]; - [pool release]; + + objc_autoreleasePoolPop(pool); return [ret autorelease]; } @end Index: src/XMPPSRVLookup.m ================================================================== --- src/XMPPSRVLookup.m +++ src/XMPPSRVLookup.m @@ -180,11 +180,11 @@ [super dealloc]; } - (void)XMPP_lookup { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + void *pool = objc_autoreleasePoolPush(); unsigned char *answer = NULL; size_t pageSize = [OFSystemInfo pageSize]; OFString *request; request = [OFString stringWithFormat: @"_xmpp-client._tcp.%@", _domain]; @@ -233,16 +233,16 @@ #ifdef HAVE_RES_NDESTROY res_ndestroy(&_resState); #endif } - [pool release]; + objc_autoreleasePoolPop(pool); } - (void)XMPP_addEntry: (XMPPSRVEntry *)entry { - OFAutoreleasePool *pool; + void *pool = objc_autoreleasePoolPush(); OFList *subList; of_list_object_t *iter; /* Look if there already is a list with the priority */ for (iter = [_list firstListObject]; iter != NULL; iter = iter->next) { @@ -264,22 +264,20 @@ /* We can't have one if the priority is already bigger */ if ([first priority] > [entry priority]) break; } - pool = [[OFAutoreleasePool alloc] init]; - subList = [OFList list]; [subList appendObject: entry]; if (iter != NULL) [_list insertObject: subList beforeListObject: iter]; else [_list appendObject: subList]; - [pool release]; + objc_autoreleasePoolPop(pool); } - (OFEnumerator *)objectEnumerator { return [[[XMPPSRVEnumerator alloc] initWithList: _list] autorelease];