diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m index aa04c76ea..3a8806f8d 100644 --- a/Source/Additions/GSMime.m +++ b/Source/Additions/GSMime.m @@ -6033,7 +6033,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold, [md appendData: d]; } } - [arp release]; + [arp drain]; return md; } @@ -6195,7 +6195,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold, [self setContent: newContent]; [self setHeader: hdr]; - [arp release]; + [arp drain]; } /** @@ -6222,7 +6222,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold, format: @"Unable to parse type information"]; } [self setHeader: hdr]; - [arp release]; + [arp drain]; } /** diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index a88775a63..d09ecfae0 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -2009,7 +2009,7 @@ GSPrintf (FILE *fptr, NSString* format, ...) ok = YES; } } - [arp release]; + [arp drain]; return ok; } diff --git a/Source/Additions/NSCalendarDate+GNUstepBase.m b/Source/Additions/NSCalendarDate+GNUstepBase.m index 2efc14639..11e1e5612 100644 --- a/Source/Additions/NSCalendarDate+GNUstepBase.m +++ b/Source/Additions/NSCalendarDate+GNUstepBase.m @@ -72,7 +72,7 @@ minutes: 0 seconds: 0]; dayOfYear = [thursday dayOfYear]; - [arp release]; + [arp drain]; } else { diff --git a/Source/Additions/NSData+GNUstepBase.m b/Source/Additions/NSData+GNUstepBase.m index 0fc8fd04f..903541b7a 100644 --- a/Source/Additions/NSData+GNUstepBase.m +++ b/Source/Additions/NSData+GNUstepBase.m @@ -152,7 +152,7 @@ DESTROY(self); } NSZoneFree(NSDefaultMallocZone(), dst); - [arp release]; + [arp drain]; if (self == nil) { [NSException raise: NSInvalidArgumentException diff --git a/Source/NSAutoreleasePool.m b/Source/NSAutoreleasePool.m index b42683141..f7f0aaf37 100644 --- a/Source/NSAutoreleasePool.m +++ b/Source/NSAutoreleasePool.m @@ -465,7 +465,9 @@ pop_pool_from_cache (struct autorelease_thread_vars *tv) - (void) drain { - [self release]; + // Don't call -release, make both -release and -drain have the same cost in + // non-GC mode. + [self dealloc]; } - (id) retain diff --git a/Source/NSBundle.m b/Source/NSBundle.m index dbd251f62..ab76a737c 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -1976,7 +1976,7 @@ IF_NO_GC( } } [result retain]; - [arp release]; + [arp drain]; return [result autorelease]; } diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 57499bf84..6594fe94c 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -721,7 +721,7 @@ static NSLock *cached_proxies_gate = nil; { proxy = [[connection rootProxy] retain]; } - [arp release]; + [arp drain]; return [proxy autorelease]; } @@ -749,7 +749,7 @@ static NSLock *cached_proxies_gate = nil; { proxy = RETAIN([connection rootProxy]); } - [arp release]; + [arp drain]; return AUTORELEASE(proxy); } @@ -1314,7 +1314,7 @@ static NSLock *cached_proxies_gate = nil; [[NSNotificationCenter defaultCenter] postNotificationName: NSConnectionDidDieNotification object: self]; - [arp release]; + [arp drain]; } /* @@ -1954,7 +1954,7 @@ static NSLock *cached_proxies_gate = nil; DESTROY(IrefGate); - [arp release]; + [arp drain]; } /* diff --git a/Source/NSDebug.m b/Source/NSDebug.m index 8c98ba2e5..008bb4f2b 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -1188,7 +1188,7 @@ GSPrivateStackAddresses(void) signal(SIGBUS, env->bus); } #endif - [pool release]; + [pool drain]; return stack; } diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index 1b34e1099..0f3923101 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -743,7 +743,7 @@ static NSDistributedNotificationCenter *netCenter = nil; rootProxyForConnectionWithRegisteredName: service host: host usingNameServer: ns]; [_remote retain]; - [pool release]; + [pool drain]; } if (_remote == nil) { diff --git a/Source/NSException.m b/Source/NSException.m index deabec63b..bc3e306ef 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -771,7 +771,7 @@ _NSFoundationUncaughtExceptionHandler (NSException *exception) [[[exception _callStack] description] lossyCString]); } fflush(stderr); /* NEEDED UNDER MINGW */ - [pool release]; + [pool drain]; _terminate(); } @@ -947,7 +947,7 @@ callUncaughtHandler(id value) [super description], _e_name, _e_reason]; } [result retain]; - [pool release]; + [pool drain]; return [result autorelease]; } diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index 5f3895f54..a64690d5a 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -681,7 +681,7 @@ static NSStringEncoding defaultEncoding; { ok = [self contentsEqualAtPath: p1 andPath: p2]; } - RELEASE(pool); + [pool drain]; } return ok; } @@ -1440,7 +1440,7 @@ static NSStringEncoding defaultEncoding; item = [contents objectAtIndex: i]; next = [path stringByAppendingPathComponent: item]; result = [self removeFileAtPath: next handler: handler]; - [arp release]; + [arp drain]; if (result == NO) { return NO; @@ -2820,7 +2820,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X) } [self changeFileAttributes: attributes atPath: destinationFile]; } - [pool release]; + [pool drain]; return YES; } @@ -2910,7 +2910,7 @@ static inline void gsedRelease(GSEnumeratedDirectory X) } [self changeFileAttributes: attributes atPath: destinationFile]; } - [pool release]; + [pool drain]; return YES; #else return NO; diff --git a/Source/NSKeyedArchiver.m b/Source/NSKeyedArchiver.m index 836b6ee60..751f56e57 100644 --- a/Source/NSKeyedArchiver.m +++ b/Source/NSKeyedArchiver.m @@ -478,7 +478,7 @@ static NSDictionary *makeReference(unsigned ref) d = [self archivedDataWithRootObject: anObject]; result = [d writeToFile: aPath atomically: YES]; - [pool release]; + [pool drain]; return result; } diff --git a/Source/NSLog.m b/Source/NSLog.m index ef4fdc15d..504858ce0 100644 --- a/Source/NSLog.m +++ b/Source/NSLog.m @@ -357,6 +357,6 @@ NSLogv (NSString* format, va_list args) [myLock unlock]; - [arp release]; + [arp drain]; } diff --git a/Source/NSMessagePort.m b/Source/NSMessagePort.m index 670f77e00..c86df8b57 100644 --- a/Source/NSMessagePort.m +++ b/Source/NSMessagePort.m @@ -1100,7 +1100,7 @@ static void clean_up_sockets(void) unlink([name bytes]); } NSEndMapTableEnumeration(&mEnum); - [arp release]; + [arp drain]; if (unknownThread == YES) { GSUnregisterCurrentThread(); diff --git a/Source/NSMessagePortNameServer.m b/Source/NSMessagePortNameServer.m index 2a2dc2554..054b4f2d2 100644 --- a/Source/NSMessagePortNameServer.m +++ b/Source/NSMessagePortNameServer.m @@ -99,7 +99,7 @@ static void clean_up_names(void) [defaultServer removePort: port]; } NSEndMapTableEnumeration(&mEnum); - [arp release]; + [arp drain]; if (unknownThread == YES) { GSUnregisterCurrentThread(); diff --git a/Source/NSPort.m b/Source/NSPort.m index 21946d3a0..a82253db8 100644 --- a/Source/NSPort.m +++ b/Source/NSPort.m @@ -160,7 +160,7 @@ static Class NSPort_concrete_class; [[NSNotificationCenter defaultCenter] postNotificationName: NSPortDidBecomeInvalidNotification object: self]; - [arp release]; + [arp drain]; } - (BOOL) isValid diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index 990b37f3b..bdf882ac2 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -449,7 +449,7 @@ _gnu_process_args(int argc, char *argv[], char *env[]) IF_NO_GC(RELEASE(keys)); IF_NO_GC(RELEASE(values)); } - IF_NO_GC(RELEASE(arp)); + [arp drain]; } #if !GS_FAKE_MAIN && ((defined(HAVE_PROCFS) || defined(HAVE_KVM_ENV) || defined(HAVE_PROCFS_PSINFO) || defined(__APPLE__)) && (defined(HAVE_LOAD_METHOD))) diff --git a/Source/NSRunLoop.m b/Source/NSRunLoop.m index acb3f262e..3487a4cc5 100644 --- a/Source/NSRunLoop.m +++ b/Source/NSRunLoop.m @@ -486,7 +486,7 @@ static inline BOOL timerInvalidated(NSTimer *t) } } } - [arp release]; + [arp drain]; } /** @@ -757,7 +757,7 @@ static inline BOOL timerInvalidated(NSTimer *t) userInfo: nil repeats: YES]; context->housekeeper = timer; - [arp release]; + [arp drain]; } } return current; @@ -1163,7 +1163,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now) } GSPrivateNotifyASAP(_currentMode); _currentMode = savedMode; - [arp release]; + [arp drain]; NS_VOIDRETURN; } @@ -1221,7 +1221,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now) [localException raise]; } NS_ENDHANDLER - [arp release]; + [arp drain]; } /** @@ -1247,7 +1247,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now) d = [self limitDateForMode: mode]; if (d == nil) { - [arp release]; + [arp drain]; return NO; } @@ -1266,7 +1266,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now) [self acceptInputForMode: mode beforeDate: d]; [d release]; - [arp release]; + [arp drain]; return YES; } diff --git a/Source/NSTask.m b/Source/NSTask.m index 33ea1d406..ef0292b5a 100644 --- a/Source/NSTask.m +++ b/Source/NSTask.m @@ -1182,7 +1182,7 @@ quotedFromString(NSString *aString) [data appendBytes: &terminator length: 2]; // end of setting } [data appendBytes: &terminator length: 2]; // end of environment - RELEASE(pool); + [pool drain]; envp = [data mutableBytes]; } diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index 943e59215..13ce8301b 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -1038,7 +1038,7 @@ static NSMapTable *absolutes = 0; [md makeImmutableCopyOnFail: NO]; abbreviationDictionary = md; } - [pool release]; + [pool drain]; } if (zone_mutex != nil) { @@ -1184,7 +1184,7 @@ static NSMapTable *absolutes = 0; [md makeImmutableCopyOnFail: NO]; abbreviationMap = RETAIN(md); - [pool release]; + [pool drain]; } if (zone_mutex != nil) { @@ -1840,7 +1840,7 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60); } } regionsArray = [[NSArray alloc] initWithObjects: temp_array count: 24]; - [pool release]; + [pool drain]; } if (zone_mutex != nil) { diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 895f323fa..a0dcb2597 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -1539,7 +1539,7 @@ static BOOL isLocked = NO; { NSLog(@"Failed to lock user defaults database even after " @"breaking old locks!"); - [arp release]; + [arp drain]; return NO; } @@ -1556,7 +1556,7 @@ static BOOL isLocked = NO; { [NSThread sleepUntilDate: when]; } - [arp release]; + [arp drain]; } isLocked = YES; diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 2df2edda2..dcf784cbe 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -1962,7 +1962,7 @@ static NSString *mainFont = nil; node = tmp; } } - RELEASE(arp); + [arp drain]; } /** diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index 25b9f2571..83d18b452 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -542,7 +542,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path) { CREATE_AUTORELEASE_POOL(pool); setDirectory(refs, path); - RELEASE(pool); + [pool drain]; } } diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 7f5d855a3..7ca0a16aa 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -1474,7 +1474,7 @@ static BOOL snuggleStart(NSString *t) [buf appendString: @"\n"]; } } - RELEASE(arp); + [arp drain]; return ind; } diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index fefc175ea..f141bf27e 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -1744,7 +1744,7 @@ recheck: { if (buffer[pos] == ')' || buffer[pos] == ',') { - RELEASE(arp); + [arp drain]; return d; } else @@ -1877,7 +1877,7 @@ recheck: } DESTROY(comment); - RELEASE(arp); + [arp drain]; if (inArgList == NO) { /* @@ -1907,7 +1907,7 @@ recheck: } fail: DESTROY(comment); - RELEASE(arp); + [arp drain]; return nil; } @@ -2206,7 +2206,7 @@ fail: */ [self skipUnit]; DESTROY(comment); - RELEASE(arp); + [arp drain]; return [NSMutableDictionary dictionary]; } else @@ -2245,13 +2245,13 @@ fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; return dict; fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; return nil; } @@ -2401,13 +2401,13 @@ fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; return dict; fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; return nil; } @@ -2950,14 +2950,14 @@ fail: } itemName = nil; - RELEASE(arp); + [arp drain]; IF_NO_GC([method autorelease];) return method; fail: itemName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; RELEASE(method); return nil; } @@ -3661,14 +3661,14 @@ fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; IF_NO_GC([dict autorelease];) return dict; fail: unitName = nil; DESTROY(comment); - RELEASE(arp); + [arp drain]; RELEASE(dict); return nil; } @@ -4108,7 +4108,7 @@ fail: buffer = [data mutableBytes]; pos = 0; lines = [[NSArray alloc] initWithArray: a]; - RELEASE(arp); + [arp drain]; IF_NO_GC([lines autorelease];) IF_NO_GC([data autorelease];) } diff --git a/Tools/HTMLLinker.m b/Tools/HTMLLinker.m index 94dd6de71..ba568c6df 100644 --- a/Tools/HTMLLinker.m +++ b/Tools/HTMLLinker.m @@ -1351,7 +1351,7 @@ int main (int argc, char** argv, char** env) } RELEASE (linker); - RELEASE (pool); + [pool drain]; return 0; } diff --git a/Tools/gspath.m b/Tools/gspath.m index 9e73f9239..2fcc7914b 100644 --- a/Tools/gspath.m +++ b/Tools/gspath.m @@ -64,7 +64,7 @@ main(int argc, char** argv, char **env) if (proc == nil) { GSPrintf(stderr, @"gspath: unable to get process information!\n"); - [pool release]; + [pool drain]; return 1; } @@ -116,7 +116,7 @@ main(int argc, char** argv, char **env) } if (ok == YES) { - [pool release]; + [pool drain]; return 0; } } @@ -141,6 +141,6 @@ main(int argc, char** argv, char **env) @"user\n" @" The GNUstep home directory of the current user\n\n" ); - [pool release]; + [pool drain]; return 1; } diff --git a/Tools/pl.m b/Tools/pl.m index 10815ed9b..50070fb2c 100644 --- a/Tools/pl.m +++ b/Tools/pl.m @@ -166,7 +166,7 @@ int main (int argc, const char *argv[]) puts(" if -output is specified."); } - [pool release]; + [pool drain]; exit(0); // insure the process exit status is 0 return 0; // ...and make main fit the ANSI spec. }