diff --git a/Source/Coder.m b/Source/Coder.m index d2ffc1e6a..cac811344 100644 --- a/Source/Coder.m +++ b/Source/Coder.m @@ -244,7 +244,7 @@ static BOOL debug_coder = NO; references. */ id o; [self decodeObjectAt: &o withName: NULL]; - return o; + return [o autorelease]; } - (unsigned int) systemVersion diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index 39a18e1cb..dc547e6a3 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -156,8 +156,8 @@ static id long_day[7] = {@"Sunday", - (id) initWithCoder: (NSCoder*)aCoder { self = [super initWithCoder: aCoder]; - calendar_format = [aCoder decodeObject]; - time_zone = [aCoder decodeObject]; + [aCoder decodeValueOfObjCType: @encode(id) at: &calendar_format]; + [aCoder decodeValueOfObjCType: @encode(id) at: &time_zone]; return self; } diff --git a/Source/NSException.m b/Source/NSException.m index 9ae9836d6..031814883 100644 --- a/Source/NSException.m +++ b/Source/NSException.m @@ -147,9 +147,9 @@ _NSFoundationUncaughtExceptionHandler(NSException *exception) - (id)initWithCoder: aDecoder { self = [super initWithCoder:aDecoder]; - e_name = [[aDecoder decodeObject] retain]; - e_reason = [[aDecoder decodeObject] retain]; - e_info = [[aDecoder decodeObject] retain]; + [aDecoder decodeObjectAt: &e_name]; + [aDecoder decodeObjectAt: &e_reason]; + [aDecoder decodeObjectAt: &e_info]; return self; } diff --git a/Source/NSGAttributedString.m b/Source/NSGAttributedString.m index 7f04fb4b8..4b7facdcd 100644 --- a/Source/NSGAttributedString.m +++ b/Source/NSGAttributedString.m @@ -176,9 +176,9 @@ NSDictionary *_attributesAtIndexEffectiveRange( - initWithCoder: aCoder { self = [super initWithCoder:aCoder]; - textChars = [[aCoder decodeObject] retain]; - attributeArray = [[aCoder decodeObject] retain]; - locateArray = [[aCoder decodeObject] retain]; + [aCoder decodeValueOfObjCType: @encode(id) at: &textChars]; + [aCoder decodeValueOfObjCType: @encode(id) at: &attributeArray]; + [aCoder decodeValueOfObjCType: @encode(id) at: &locateArray]; return self; } @@ -241,9 +241,9 @@ NSDictionary *_attributesAtIndexEffectiveRange( - initWithCoder: aCoder { self = [super initWithCoder:aCoder]; - textChars = [[aCoder decodeObject] retain]; - attributeArray = [[aCoder decodeObject] retain]; - locateArray = [[aCoder decodeObject] retain]; + [aCoder decodeValueOfObjCType: @encode(id) at: &textChars]; + [aCoder decodeValueOfObjCType: @encode(id) at: &attributeArray]; + [aCoder decodeValueOfObjCType: @encode(id) at: &locateArray]; return self; } diff --git a/Source/NSHost.m b/Source/NSHost.m index e240e638b..20953a4a1 100644 --- a/Source/NSHost.m +++ b/Source/NSHost.m @@ -139,7 +139,7 @@ static NSMutableDictionary *_hostCache = nil; + (void)initialize { _hostCacheLock = [[NSConditionLock alloc] init]; - _hostCache = [[NSMutableDictionary dictionary] retain]; + _hostCache = [NSMutableDictionary new]; } + (NSHost *)currentHost @@ -246,7 +246,6 @@ static NSMutableDictionary *_hostCache = nil; [super initWithCoder: aCoder]; address = [aCoder decodeObject]; addresses = [NSArray arrayWithObject: address]; - [address release]; return self; } #endif diff --git a/Source/NSLog.m b/Source/NSLog.m index 430b57ba3..b372457f0 100644 --- a/Source/NSLog.m +++ b/Source/NSLog.m @@ -26,6 +26,7 @@ #include #include #include +#include #ifndef __WIN32__ #include @@ -52,6 +53,7 @@ NSLog (NSString* format, ...) void NSLogv (NSString* format, va_list args) { + NSAutoreleasePool *arp = [NSAutoreleasePool new]; NSString* prefix; NSString* message; @@ -72,5 +74,6 @@ NSLogv (NSString* format, va_list args) prefix = [prefix stringByAppendingString: message]; _NSLog_printf_handler (prefix); + [arp release]; } diff --git a/Source/NSProcessInfo.m b/Source/NSProcessInfo.m index f2365d7f2..d242ebd44 100644 --- a/Source/NSProcessInfo.m +++ b/Source/NSProcessInfo.m @@ -70,6 +70,7 @@ #include #include #include +#include /* This error message should be called only if the private main function * was not executed successfully. This may heppen ONLY if onother library @@ -138,6 +139,7 @@ static NSMutableArray* _debug_array = nil; static void _gnu_process_args(int argc, char *argv[], char *env[]) { + NSAutoreleasePool *arp = [NSAutoreleasePool new]; int i; /* Getting the process name */ @@ -187,6 +189,7 @@ _gnu_process_args(int argc, char *argv[], char *env[]) [keys release]; [values release]; } + [arp release]; } /* Place the _gnu_process_args function in the _libc_subinit section so diff --git a/Source/NSTimeZone.m b/Source/NSTimeZone.m index 02d1ea859..9de84cb88 100644 --- a/Source/NSTimeZone.m +++ b/Source/NSTimeZone.m @@ -344,7 +344,7 @@ decode (const void *ptr) - initWithDecoder: aDecoder { self = [super initWithCoder: aDecoder]; - name = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(id) at: &name]; return self; } @@ -425,7 +425,7 @@ decode (const void *ptr) - initWithCoder: aDecoder { self = [super initWithCoder: aDecoder]; - name = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(id) at: &name]; offset = [name intValue]; return self; } @@ -479,7 +479,7 @@ decode (const void *ptr) - initWithCoder: aDecoder { self = [super initWithCoder: aDecoder]; - abbrev = [aDecoder decodeObject]; + [aDecoder decodeValueOfObjCType: @encode(id) at: &abbrev]; [aDecoder decodeValueOfObjCType: @encode(int) at: &offset]; [aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_dst]; return self;