Stop using OFAutoreleasePool

This commit is contained in:
Jonathan Schleifer 2017-07-23 13:35:12 +02:00
parent cb5f6bfe40
commit 631b4e1a9d
No known key found for this signature in database
GPG key ID: 28D65178B37F33E3
7 changed files with 54 additions and 54 deletions

View file

@ -130,7 +130,7 @@ OF_ASSUME_NONNULL_END
- (id)main
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
void *pool = objc_autoreleasePoolPush();
[_connection connect];
@ -138,7 +138,7 @@ OF_ASSUME_NONNULL_END
onThread: _sourceThread
waitUntilDone: false];
[pool release];
objc_autoreleasePoolPop(pool);
return nil;
}
@ -318,7 +318,7 @@ OF_ASSUME_NONNULL_END
- (void)connect
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
void *pool = objc_autoreleasePoolPush();
XMPPSRVEntry *candidate = nil;
XMPPSRVLookup *SRVLookup = nil;
OFEnumerator *enumerator;
@ -361,7 +361,7 @@ OF_ASSUME_NONNULL_END
[self XMPP_startStream];
[pool release];
objc_autoreleasePoolPop(pool);
}
- (void)handleConnection
@ -377,13 +377,13 @@ OF_ASSUME_NONNULL_END
- (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
@ -522,12 +522,10 @@ OF_ASSUME_NONNULL_END
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];
@ -543,7 +541,8 @@ OF_ASSUME_NONNULL_END
selector: selector];
[_callbacks setObject: callback
forKey: key];
[pool release];
objc_autoreleasePoolPop(pool);
[self sendStanza: IQ];
}
@ -552,12 +551,10 @@ OF_ASSUME_NONNULL_END
- (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];
@ -572,7 +569,8 @@ OF_ASSUME_NONNULL_END
callback = [XMPPCallback callbackWithBlock: block];
[_callbacks setObject: callback
forKey: key];
[pool release];
objc_autoreleasePoolPop(pool);
[self sendStanza: IQ];
}

View file

@ -124,22 +124,22 @@
- (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;
}
@ -147,22 +147,22 @@
- (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;
}
@ -170,22 +170,22 @@
- (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;
}
@ -193,22 +193,22 @@
- (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;
}
@ -216,22 +216,22 @@
- (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;
}

View file

@ -70,7 +70,7 @@
{
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];
@ -86,7 +86,7 @@
[ret setTo: [self from]];
[ret setFrom: nil];
[pool release];
objc_autoreleasePoolPop(pool);
return ret;
}

View file

@ -74,7 +74,7 @@
- (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];
@ -92,7 +92,7 @@
handled |= imp(responder, selector, object);
}
[pool release];
objc_autoreleasePoolPop(pool);
return handled;
}
@ -101,7 +101,7 @@
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];
@ -119,7 +119,7 @@
handled |= imp(responder, selector, object1, object2);
}
[pool release];
objc_autoreleasePoolPop(pool);
return handled;
}

View file

@ -353,18 +353,18 @@ OF_ASSUME_NONNULL_END
}
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) {

View file

@ -433,7 +433,7 @@ OF_ASSUME_NONNULL_END
- (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;
@ -480,7 +480,8 @@ OF_ASSUME_NONNULL_END
}
[hashO retain];
[pool release];
objc_autoreleasePoolPop(pool);
return [[hashO autorelease] digest];
}
@ -489,7 +490,7 @@ OF_ASSUME_NONNULL_END
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;
@ -516,7 +517,9 @@ OF_ASSUME_NONNULL_END
[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
@ -535,7 +538,8 @@ OF_ASSUME_NONNULL_END
}
[ret retain];
[pool release];
objc_autoreleasePoolPop(pool);
return [ret autorelease];
}

View file

@ -182,7 +182,7 @@ OF_ASSUME_NONNULL_END
- (void)XMPP_lookup
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
void *pool = objc_autoreleasePoolPush();
unsigned char *answer = NULL;
size_t pageSize = [OFSystemInfo pageSize];
OFString *request;
@ -235,12 +235,12 @@ OF_ASSUME_NONNULL_END
#endif
}
[pool release];
objc_autoreleasePoolPop(pool);
}
- (void)XMPP_addEntry: (XMPPSRVEntry *)entry
{
OFAutoreleasePool *pool;
void *pool = objc_autoreleasePoolPush();
OFList *subList;
of_list_object_t *iter;
@ -266,8 +266,6 @@ OF_ASSUME_NONNULL_END
break;
}
pool = [[OFAutoreleasePool alloc] init];
subList = [OFList list];
[subList appendObject: entry];
@ -277,7 +275,7 @@ OF_ASSUME_NONNULL_END
else
[_list appendObject: subList];
[pool release];
objc_autoreleasePoolPop(pool);
}
- (OFEnumerator *)objectEnumerator