diff options
41 files changed, 141 insertions, 388 deletions
diff --git a/AddressBook/GTMABAddressBook.m b/AddressBook/GTMABAddressBook.m index 77d194d..1b9276a 100644 --- a/AddressBook/GTMABAddressBook.m +++ b/AddressBook/GTMABAddressBook.m @@ -17,7 +17,6 @@ // #import "GTMABAddressBook.h" -#import "GTMGarbageCollection.h" #import "GTMTypeCasting.h" #if GTM_IPHONE_SDK diff --git a/AppKit/GTMCarbonEvent.m b/AppKit/GTMCarbonEvent.m index 515a1e1..235306e 100644 --- a/AppKit/GTMCarbonEvent.m +++ b/AppKit/GTMCarbonEvent.m @@ -18,7 +18,6 @@ #import "GTMCarbonEvent.h" #import <AppKit/AppKit.h> -#import "GTMObjectSingleton.h" #import "GTMDebugSelectorValidation.h" #import "GTMTypeCasting.h" @@ -477,8 +476,13 @@ static OSStatus EventHandler(EventHandlerCallRef inHandler, @implementation GTMCarbonEventMonitorHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventMonitorHandler, - sharedEventMonitorHandler); ++ (GTMCarbonEventMonitorHandler *)sharedEventMonitorHandler { + static GTMCarbonEventMonitorHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (EventTargetRef)eventTarget { return GetEventMonitorTarget(); @@ -494,8 +498,13 @@ extern EventTargetRef GetApplicationEventTarget(void); @implementation GTMCarbonEventApplicationEventHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventApplicationEventHandler, - sharedApplicationEventHandler); ++ (GTMCarbonEventApplicationEventHandler *)sharedApplicationEventHandler { + static GTMCarbonEventApplicationEventHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (EventTargetRef)eventTarget { return GetApplicationEventTarget(); @@ -505,8 +514,13 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventApplicationEventHandler, @implementation GTMCarbonEventDispatcherHandler -GTMOBJECT_SINGLETON_BOILERPLATE(GTMCarbonEventDispatcherHandler, - sharedEventDispatcherHandler); ++ (GTMCarbonEventDispatcherHandler *)sharedEventDispatcherHandler { + static GTMCarbonEventDispatcherHandler *obj = nil; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} // Register for the events we handle, and set up the dictionaries we need // to keep track of the hotkeys and commands that we handle. diff --git a/AppKit/GTMGetURLHandler.m b/AppKit/GTMGetURLHandler.m index e038530..a5f7c5d 100644 --- a/AppKit/GTMGetURLHandler.m +++ b/AppKit/GTMGetURLHandler.m @@ -56,7 +56,6 @@ // @end #import <AppKit/AppKit.h> -#import "GTMGarbageCollection.h" #import "GTMNSAppleEventDescriptor+Foundation.h" #import "GTMMethodCheck.h" @@ -119,7 +118,6 @@ withReplyEvent:(NSAppleEventDescriptor *)replyEvent { sHandler = [GTMGetURLHandler handlerForBundle:bundle]; if (sHandler) { [sHandler retain]; - GTMNSMakeUncollectable(sHandler); } } [sHandler getUrl:event withReplyEvent:replyEvent]; diff --git a/AppKit/GTMGoogleSearch.m b/AppKit/GTMGoogleSearch.m index 9eb095f..320c71d 100644 --- a/AppKit/GTMGoogleSearch.m +++ b/AppKit/GTMGoogleSearch.m @@ -17,8 +17,7 @@ // #import "GTMGoogleSearch.h" -#import "GTMObjectSingleton.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" #if GTM_IPHONE_SDK #import <UIKit/UIKit.h> @@ -128,7 +127,13 @@ static NSString *const kDefaultLanguage = @"en"; @implementation GTMGoogleSearch -GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); ++ (GTMGoogleSearch *)sharedInstance { + static GTMGoogleSearch *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (id)init { self = [super init]; @@ -166,8 +171,8 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); } } - curAppCachedDomain_ = GTMNSMakeCollectable(domain); - curAppCachedLanguage_ = GTMNSMakeCollectable(lang); + curAppCachedDomain_ = (NSString *)domain; + curAppCachedLanguage_ = (NSString *)lang; NSBundle *bundle = [NSBundle mainBundle]; @@ -180,14 +185,14 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); #if GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - (void)finalize { - [[NSDistributedNotificationCenter defaultCenter] removeObject:self]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; [super finalize]; } #endif // GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - (void)dealloc { #if GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS - [[NSDistributedNotificationCenter defaultCenter] removeObject:self]; + [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; #endif // GTM_GOOGLE_SEARCH_SUPPORTS_DISTRIBUTED_NOTIFICATIONS [allAppsCachedDomain_ release]; [allAppsCachedLanguage_ release]; @@ -484,8 +489,8 @@ GTMOBJECT_SINGLETON_BOILERPLATE(GTMGoogleSearch, sharedInstance); } } - allAppsCachedDomain_ = GTMNSMakeCollectable(domain); - allAppsCachedLanguage_ = GTMNSMakeCollectable(lang); + allAppsCachedDomain_ = (NSString *)domain; + allAppsCachedLanguage_ = (NSString *)lang; } // -updateAllAppsDomain:language: diff --git a/AppKit/GTMHotKeyTextField.m b/AppKit/GTMHotKeyTextField.m index 5ef59b4..a33277a 100644 --- a/AppKit/GTMHotKeyTextField.m +++ b/AppKit/GTMHotKeyTextField.m @@ -18,7 +18,6 @@ #import "GTMHotKeyTextField.h" #import <Carbon/Carbon.h> -#import "GTMObjectSingleton.h" #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 #import "GTMSystemVersion.h" @@ -570,7 +569,13 @@ static CFStringRef kGTM_TISPropertyUnicodeKeyLayoutData = NULL; @implementation GTMHotKeyFieldEditor -GTMOBJECT_SINGLETON_BOILERPLATE(GTMHotKeyFieldEditor, sharedHotKeyFieldEditor) ++ (GTMHotKeyFieldEditor *)sharedHotKeyFieldEditor { + static GTMHotKeyFieldEditor *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} - (id)init { if ((self = [super init])) { diff --git a/AppKit/GTMLargeTypeWindowTest.m b/AppKit/GTMLargeTypeWindowTest.m index 442fbac..a60c791 100644 --- a/AppKit/GTMLargeTypeWindowTest.m +++ b/AppKit/GTMLargeTypeWindowTest.m @@ -20,7 +20,6 @@ #import "GTMLargeTypeWindow.h" #import "GTMNSObject+UnitTesting.h" #import "GTMUnitTestDevLog.h" -#import "GTMGarbageCollection.h" #import "GTMSystemVersion.h" NSString *const kLongTextBlock = @@ -58,21 +57,8 @@ NSString *const kShortTextBlock = @"Short"; @implementation GTMLargeTypeWindowTest - (BOOL)shouldDoAnimateCopy { - // NOTE: Animated copy tests are disabled when GC is on. - // See the comment/warning in the GTMLargeTypeWindow.h for more details, - // but we disable them to avoid the tests failing (crashing) when it's Apple's - // bug. Please bump the system check as appropriate when new systems are - // tested. Currently broken on 10.5.6 and below. - // Radar 6137322 CIFilter crashing when run with GC enabled - SInt32 major, minor, bugfix; - [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugfix]; - if (!(GTMIsGarbageCollectionEnabled() - && major <= 10 && minor <= 5 && bugfix <= 6)) { - return YES; - } else { - NSLog(@"--- animated copy not run because of GC incompatibilites ---"); - return NO; - } + // This method previously checked for incompatibilities with garbage collection. + return YES; } - (void)setUp { diff --git a/AppKit/GTMLoginItems.m b/AppKit/GTMLoginItems.m index 1d2c56a..fc0029b 100644 --- a/AppKit/GTMLoginItems.m +++ b/AppKit/GTMLoginItems.m @@ -19,7 +19,6 @@ #import "GTMLoginItems.h" #import "GTMDefines.h" -#import "GTMGarbageCollection.h" #include <Carbon/Carbon.h> diff --git a/AppKit/GTMNSBezierPath+CGPath.m b/AppKit/GTMNSBezierPath+CGPath.m index 3624d9e..dd5c5f2 100644 --- a/AppKit/GTMNSBezierPath+CGPath.m +++ b/AppKit/GTMNSBezierPath+CGPath.m @@ -19,7 +19,6 @@ // #import "GTMNSBezierPath+CGPath.h" #import "GTMDefines.h" -#import "GTMGarbageCollection.h" @implementation NSBezierPath (GTMBezierPathCGPathAdditions) diff --git a/AppKit/GTMNSImage+SearchCache.m b/AppKit/GTMNSImage+SearchCache.m index 037e0c8..21f2ce8 100644 --- a/AppKit/GTMNSImage+SearchCache.m +++ b/AppKit/GTMNSImage+SearchCache.m @@ -19,7 +19,7 @@ // #import "GTMNSImage+SearchCache.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" @implementation NSImage (GTMNSImageSearchCache) + (NSImage *)gtm_imageWithPath:(NSString *)path { diff --git a/AppKit/GTMNSWorkspace+Running.m b/AppKit/GTMNSWorkspace+Running.m index a3a1b6d..7d6efff 100644 --- a/AppKit/GTMNSWorkspace+Running.m +++ b/AppKit/GTMNSWorkspace+Running.m @@ -19,9 +19,8 @@ #import "GTMNSWorkspace+Running.h" #import <Carbon/Carbon.h> #import <unistd.h> -#import "GTMGarbageCollection.h" #import "GTMSystemVersion.h" -#import "GTMObjectSingleton.h" + NSString *const kGTMWorkspaceRunningPSN = @"PSN"; NSString *const kGTMWorkspaceRunningFlavor = @"Flavor"; @@ -190,8 +189,14 @@ NSString *const kGTMWorkspaceRunningBundleVersion = @"CFBundleVersion"; @implementation GTMWorkspaceRunningApplicationList -GTMOBJECT_SINGLETON_BOILERPLATE(GTMWorkspaceRunningApplicationList, - sharedApplicationList) ++ (GTMWorkspaceRunningApplicationList *)sharedApplicationList { + static GTMWorkspaceRunningApplicationList *obj; + if (!obj) { + obj = [[self alloc] init]; + } + return obj; +} + - (id)init { if ((self = [super init])) { [self didLaunchOrTerminateApp:nil]; diff --git a/AppKit/GTMUILocalizerAndLayoutTweaker.m b/AppKit/GTMUILocalizerAndLayoutTweaker.m index d2ff80c..14876dc 100644 --- a/AppKit/GTMUILocalizerAndLayoutTweaker.m +++ b/AppKit/GTMUILocalizerAndLayoutTweaker.m @@ -18,7 +18,6 @@ #import "GTMUILocalizerAndLayoutTweaker.h" #import "GTMUILocalizer.h" -#import "GTMNSNumber+64Bit.h" // Controls if +wrapString:width:font: uses a subclassed TypeSetter to do // its work in one pass. @@ -69,7 +68,7 @@ static const CGFloat kWrapperStringSlop = 0.9; } - (BOOL)shouldBreakLineByWordBeforeCharacterAtIndex:(NSUInteger)charIndex { - [array_ addObject:[NSNumber gtm_numberWithUnsignedInteger:charIndex]]; + [array_ addObject:[NSNumber numberWithUnsignedInteger:charIndex]]; return YES; } @@ -207,7 +206,7 @@ static const CGFloat kWrapperStringSlop = 0.9; NSNumber *number; while ((number = [reverseEnumerator nextObject]) != nil) { [workerStr insertString:kForcedWrapString - atIndex:[number gtm_unsignedIntegerValue]]; + atIndex:[number unsignedIntegerValue]]; } #else // Find out how tall lines would be for the layout loop. @@ -454,7 +453,11 @@ static const CGFloat kWrapperStringSlop = 0.9; // once we know this view's size. if (IsRightAnchored(subView)) { [rightAlignedSubViews addObject:subView]; - NSNumber *nsDelta = [NSNumber gtm_numberWithCGFloat:delta]; +#if CGFLOAT_IS_DOUBLE + NSNumber *nsDelta = [NSNumber numberWithDouble:delta]; +#else + NSNumber *nsDelta = [NSNumber numberWithFloat:delta]; +#endif [rightAlignedSubViewDeltas addObject:nsDelta]; } } diff --git a/Foundation/GTMAbstractDOListenerTest.m b/Foundation/GTMAbstractDOListenerTest.m index 2cb4557..d26d4fc 100644 --- a/Foundation/GTMAbstractDOListenerTest.m +++ b/Foundation/GTMAbstractDOListenerTest.m @@ -19,9 +19,6 @@ #import "GTMSenTestCase.h" #import "GTMAbstractDOListener.h" -// Needed for GTMIsGarbageCollectionEnabled -#import "GTMGarbageCollection.h" - // Needed for GTMUnitTestDevLog expectPattern #import "GTMUnitTestDevLog.h" @@ -358,16 +355,11 @@ enum { listenerCount + 1, nil); [pool drain]; - if (!GTMIsGarbageCollectionEnabled()) { - // Not much point with GC on. - STAssertEquals([listener retainCount], (NSUInteger)1, nil); - } + STAssertEquals([listener retainCount], (NSUInteger)1, nil); [listener release]; - if (!GTMIsGarbageCollectionEnabled()) { - STAssertEquals([[GTMAbstractDOListener allListeners] count], listenerCount, - nil); - } + STAssertEquals([[GTMAbstractDOListener allListeners] count], listenerCount, + nil); } @end diff --git a/Foundation/GTMFileSystemKQueueTest.m b/Foundation/GTMFileSystemKQueueTest.m index d80f161..a8eec37 100644 --- a/Foundation/GTMFileSystemKQueueTest.m +++ b/Foundation/GTMFileSystemKQueueTest.m @@ -18,7 +18,6 @@ #import "GTMSenTestCase.h" #import "GTMFileSystemKQueue.h" -#import "GTMGarbageCollection.h" #import "GTMUnitTestDevLog.h" @@ -509,15 +508,10 @@ #endif // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 // Now destroy the queue, with events outstanding from the CFSocket, but - // unconsumed. For GC this involves us using a private method since |helper| - // still has a reference. For non-GC we'll force the release. - if (GTMIsGarbageCollectionEnabled()) { - [testKQ unregisterWithKQueue]; - } else { - STAssertEquals([testKQ retainCount], (NSUInteger)1, nil); - [testKQ release]; - testKQ = nil; - } + // unconsumed. + STAssertEquals([testKQ retainCount], (NSUInteger)1, nil); + [testKQ release]; + testKQ = nil; // Spin the runloop, no events were delivered (and we should not hang) [self spinForEvents:helper]; diff --git a/Foundation/GTMFourCharCode.m b/Foundation/GTMFourCharCode.m index 44ab688..02eea23 100644 --- a/Foundation/GTMFourCharCode.m +++ b/Foundation/GTMFourCharCode.m @@ -19,7 +19,6 @@ #import "GTMDefines.h" #import "GTMFourCharCode.h" -#import "GTMGarbageCollection.h" #import <CoreServices/CoreServices.h> @implementation GTMFourCharCode diff --git a/Foundation/GTMGarbageCollection.h b/Foundation/GTMGarbageCollection.h index 93d4efa..19ba255 100644 --- a/Foundation/GTMGarbageCollection.h +++ b/Foundation/GTMGarbageCollection.h @@ -1,72 +1,4 @@ // -// GTMGarbageCollection.h +// This file previously included utility functions for working +// with Garbage Collection on Mac OS X. // -// Copyright 2007-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -#import <Foundation/Foundation.h> - -#import "GTMDefines.h" - -// This allows us to easily move our code from GC to non GC. -// They are no-ops unless we are require Leopard or above. -// See -// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/index.html -// and -// http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html#//apple_ref/doc/uid/TP40006687-SW1 -// for details. - -#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) && !GTM_IPHONE_SDK -// General use would be to call this through GTMCFAutorelease -// but there may be a reason the you want to make something collectable -// but not autoreleased, especially in pure GC code where you don't -// want to bother with the nop autorelease. Done as a define instead of an -// inline so that tools like Clang's scan-build don't report code as leaking. -#define GTMNSMakeCollectable(cf) ((id)NSMakeCollectable(cf)) - -// GTMNSMakeUncollectable is for global maps, etc. that we don't -// want released ever. You should still retain these in non-gc code. -GTM_INLINE void GTMNSMakeUncollectable(id object) { - [[NSGarbageCollector defaultCollector] disableCollectorForPointer:object]; -} - -// Hopefully no code really needs this, but GTMIsGarbageCollectionEnabled is -// a common way to check at runtime if GC is on. -// There are some places where GC doesn't work w/ things w/in Apple's -// frameworks, so this is here so GTM unittests and detect it, and not run -// individual tests to work around bugs in Apple's frameworks. -GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) { - return ([NSGarbageCollector defaultCollector] != nil); -} - -#else - -#define GTMNSMakeCollectable(cf) ((id)(cf)) - -GTM_INLINE void GTMNSMakeUncollectable(id object) { -} - -GTM_INLINE BOOL GTMIsGarbageCollectionEnabled(void) { - return NO; -} - -#endif - -// GTMCFAutorelease makes a CF object collectable in GC mode, or adds it -// to the autorelease pool in non-GC mode. Either way it is taken care -// of. Done as a define instead of an inline so that tools like Clang's -// scan-build don't report code as leaking. -#define GTMCFAutorelease(cf) ([GTMNSMakeCollectable(cf) autorelease]) - diff --git a/Foundation/GTMLogger.m b/Foundation/GTMLogger.m index 4b40747..424f3c0 100644 --- a/Foundation/GTMLogger.m +++ b/Foundation/GTMLogger.m @@ -17,7 +17,6 @@ // #import "GTMLogger.h" -#import "GTMGarbageCollection.h" #import <fcntl.h> #import <unistd.h> #import <stdlib.h> diff --git a/Foundation/GTMNSAppleScript+Handler.h b/Foundation/GTMNSAppleScript+Handler.h index 8fcb8fc..ba4fe72 100644 --- a/Foundation/GTMNSAppleScript+Handler.h +++ b/Foundation/GTMNSAppleScript+Handler.h @@ -19,13 +19,6 @@ #import <Foundation/Foundation.h> #import "GTMDefines.h" -// :::WARNING::: NSAppleScript and Garbage Collect (GC) -// -// As of 10.5.6 (and below) Apple has bugs in NSAppleScript when running with -// GC; ie-things crash that have nothing to do w/ this or your code. See -// http://rails.wincent.com/issues/640 for a good amount of detail about the -// problems and simple cases that show it. - // A category for calling handlers in NSAppleScript enum { diff --git a/Foundation/GTMNSAppleScript+Handler.m b/Foundation/GTMNSAppleScript+Handler.m index 34b21c6..e17ba91 100644 --- a/Foundation/GTMNSAppleScript+Handler.m +++ b/Foundation/GTMNSAppleScript+Handler.m @@ -203,7 +203,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); if (propertyName && desc) { NSAppleScript *script = self; OSAID valueID = kOSANullScript; - ComponentInstance component; + ComponentInstance component = NULL; OSAID scriptID = [script gtm_realIDAndComponent:&component]; error = OSACoerceFromDesc(component, [desc aeDesc], @@ -256,7 +256,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); } - (BOOL)gtm_hasOpenDocumentsHandler { - ComponentInstance component; + ComponentInstance component = NULL; OSAID osaID = [self gtm_realIDAndComponent:&component]; long value = 0; OSAError error = OSAGetScriptInfo(component, @@ -332,7 +332,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); NSAppleEventDescriptor *propertyName = [self gtm_descriptorForPropertyValue:property]; if (propertyName) { - ComponentInstance component; + ComponentInstance component = NULL; OSAID scriptID = [self gtm_realIDAndComponent:&component]; OSAID valueID = kOSANullScript; error = OSAGetProperty(component, @@ -380,7 +380,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); GTMAssertRunningOnMainThread(); AEDescList names = { typeNull, NULL }; NSArray *array = nil; - ComponentInstance component; + ComponentInstance component = NULL; OSAID osaID = [self gtm_realIDAndComponent:&component]; OSAError error = OSAGetHandlerNames(component, kOSAModeNull, osaID, &names); if (error == noErr) { @@ -399,7 +399,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); GTMAssertRunningOnMainThread(); AEDescList names = { typeNull, NULL }; NSArray *array = nil; - ComponentInstance component; + ComponentInstance component = NULL; OSAID osaID = [self gtm_realIDAndComponent:&component]; OSAError error = OSAGetPropertyNames(component, kOSAModeNull, osaID, &names); if (error == noErr) { @@ -495,7 +495,7 @@ GTM_METHOD_CHECK(NSAppleEventDescriptor, gtm_registerSelector:forTypes:count:); if (!error) { NSAppleEventDescriptor *desc = nil; NSAppleEventDescriptor *event = [data objectForKey:GTMNSAppleScriptEventKey]; - ComponentInstance component; + ComponentInstance component = NULL; OSAID scriptID = [self gtm_realIDAndComponent:&component]; OSAID valueID; OSAError err = OSAExecuteEvent(component, [event aeDesc], scriptID, diff --git a/Foundation/GTMNSAppleScript+HandlerTest.m b/Foundation/GTMNSAppleScript+HandlerTest.m index 16886a8..6a064dd 100644 --- a/Foundation/GTMNSAppleScript+HandlerTest.m +++ b/Foundation/GTMNSAppleScript+HandlerTest.m @@ -21,7 +21,6 @@ #import "GTMNSAppleScript+Handler.h" #import "GTMNSAppleEventDescriptor+Foundation.h" #import "GTMUnitTestDevLog.h" -#import "GTMGarbageCollection.h" #import "GTMSystemVersion.h" #import "GTMFourCharCode.h" @@ -37,21 +36,6 @@ @end @implementation GTMNSAppleScript_HandlerTest -- (void)invokeTest { - // NOTE: These tests are disabled in GC is on. See the comment/warning in the - // GTMNSAppleScript+Handler.h for more details, but we disable them to avoid - // the tests failing (crashing) when it's Apple's bug. Please bump the system - // check as appropriate when new systems are tested. Currently broken on - // 10.5.8 and below. Radar 6126682. - SInt32 major, minor, bugfix; - [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugfix]; - BOOL gcEnabled = GTMIsGarbageCollectionEnabled(); - if (gcEnabled && major <= 10 && minor <= 5 && bugfix <= 8) { - NSLog(@"--- %@ NOT run because of GC incompatibilites ---", [self name]); - } else { - [super invokeTest]; - } -} - (void)setUp { NSBundle *bundle diff --git a/Foundation/GTMNSDictionary+CaseInsensitive.m b/Foundation/GTMNSDictionary+CaseInsensitive.m index a207000..96494c2 100644 --- a/Foundation/GTMNSDictionary+CaseInsensitive.m +++ b/Foundation/GTMNSDictionary+CaseInsensitive.m @@ -18,7 +18,6 @@ #import "GTMNSDictionary+CaseInsensitive.h" #import "GTMDefines.h" -#import "GTMGarbageCollection.h" #import <CoreFoundation/CoreFoundation.h> @interface NSMutableDictionary (GTMNSMutableDictionaryCaseInsensitiveAdditions) @@ -85,14 +84,9 @@ static CFHashCode CaseInsensitiveHashCallback(const void *value) { keyCallbacks.equal = CaseInsensitiveEqualCallback; keyCallbacks.hash = CaseInsensitiveHashCallback; - // GTMNSMakeCollectable drops the retain count in GC mode so the object can - // be garbage collected. - // GTMNSMakeCollectable not GTMCFAutorelease because this is an initializer - // and in non-GC mode we need to return a +1 retain count object. - self = GTMNSMakeCollectable( - CFDictionaryCreate(kCFAllocatorDefault, - keys, values, count, &keyCallbacks, - &kCFTypeDictionaryValueCallBacks)); + self = (id)CFDictionaryCreate(kCFAllocatorDefault, + keys, values, count, &keyCallbacks, + &kCFTypeDictionaryValueCallBacks); free(keys); free(values); @@ -111,13 +105,8 @@ static CFHashCode CaseInsensitiveHashCallback(const void *value) { - (id)gtm_initWithDictionaryCaseInsensitive:(NSDictionary *)dictionary { if ((self = [super gtm_initWithDictionaryCaseInsensitive:dictionary])) { - // GTMNSMakeCollectable drops the retain count in GC mode so the object can - // be garbage collected. - // GTMNSMakeCollectable not GTMCFAutorelease because this is an initializer - // and in non-GC mode we need to return a +1 retain count object. - id copy = GTMNSMakeCollectable( - CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, - (CFDictionaryRef)self)); + id copy = (id)CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, + (CFDictionaryRef)self); [self release]; self = copy; } diff --git a/Foundation/GTMNSFileManager+Carbon.m b/Foundation/GTMNSFileManager+Carbon.m index 9b91a4d..8c51f66 100644 --- a/Foundation/GTMNSFileManager+Carbon.m +++ b/Foundation/GTMNSFileManager+Carbon.m @@ -20,7 +20,6 @@ #import <CoreServices/CoreServices.h> #import <sys/param.h> #import "GTMDefines.h" -#import "GTMGarbageCollection.h" @implementation NSFileManager (GTMFileManagerCarbonAdditions) diff --git a/Foundation/GTMNSString+FindFolder.m b/Foundation/GTMNSString+FindFolder.m index 2e847e3..1e1b50a 100644 --- a/Foundation/GTMNSString+FindFolder.m +++ b/Foundation/GTMNSString+FindFolder.m @@ -17,7 +17,7 @@ // #import "GTMNSString+FindFolder.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" @implementation NSString (GTMStringFindFolderAdditions) diff --git a/Foundation/GTMNSString+URLArguments.m b/Foundation/GTMNSString+URLArguments.m index 46d2c99..90c65c5 100644 --- a/Foundation/GTMNSString+URLArguments.m +++ b/Foundation/GTMNSString+URLArguments.m @@ -17,7 +17,8 @@ // #import "GTMNSString+URLArguments.h" -#import "GTMGarbageCollection.h" + +#import "GTMDefines.h" @implementation NSString (GTMNSStringURLArgumentsAdditions) diff --git a/Foundation/GTMNSString+XML.m b/Foundation/GTMNSString+XML.m index 0e16ddb..2e165e6 100644 --- a/Foundation/GTMNSString+XML.m +++ b/Foundation/GTMNSString+XML.m @@ -18,7 +18,6 @@ #import "GTMDefines.h" #import "GTMNSString+XML.h" -#import "GTMGarbageCollection.h" enum { kGTMXMLCharModeEncodeQUOT = 0, diff --git a/Foundation/GTMSQLite.m b/Foundation/GTMSQLite.m index 29980ae..502a5cc 100644 --- a/Foundation/GTMSQLite.m +++ b/Foundation/GTMSQLite.m @@ -27,7 +27,6 @@ #import "GTMMethodCheck.h" #import "GTMDefines.h" #include <limits.h> -#import "GTMGarbageCollection.h" typedef struct { BOOL upperCase; diff --git a/Foundation/GTMSQLiteTest.m b/Foundation/GTMSQLiteTest.m index a158a4f..8a5f18d 100644 --- a/Foundation/GTMSQLiteTest.m +++ b/Foundation/GTMSQLiteTest.m @@ -20,7 +20,6 @@ #import "GTMSQLite.h" #import "GTMSenTestCase.h" #import "GTMUnitTestDevLog.h" -#import "GTMGarbageCollection.h" @interface GTMSQLiteTest : GTMTestCase @end @@ -1744,51 +1743,47 @@ static NSArray* LikeGlobTestHelper(GTMSQLiteDatabase *db, NSString *sql) { } - (void)testThatNotFinalizingStatementsThrowsAssertion { - // The run-time check is discouraged, but we're using it because the - // same test binary is used for both GC & Non-GC runs - if (!GTMIsGarbageCollectionEnabled()) { - NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; - int err; - GTMSQLiteDatabase *db = - [[[GTMSQLiteDatabase alloc] initInMemoryWithCFAdditions:YES - utf8:YES - errorCode:&err] - autorelease]; + int err; + GTMSQLiteDatabase *db = + [[[GTMSQLiteDatabase alloc] initInMemoryWithCFAdditions:YES + utf8:YES + errorCode:&err] + autorelease]; - STAssertNotNil(db, @"Failed to create database"); + STAssertNotNil(db, @"Failed to create database"); - sqlite3 *sqlite3DB = [db sqlite3DB]; - - NSString *selectSQL = @"select 1"; - GTMSQLiteStatement *statement; - statement = [GTMSQLiteStatement statementWithSQL:selectSQL - inDatabase:db - errorCode:&err]; - STAssertNotNil(statement, @"Failed to create select statement"); - STAssertEquals(err, SQLITE_OK, @"Failed to create select statement"); + sqlite3 *sqlite3DB = [db sqlite3DB]; + + NSString *selectSQL = @"select 1"; + GTMSQLiteStatement *statement; + statement = [GTMSQLiteStatement statementWithSQL:selectSQL + inDatabase:db + errorCode:&err]; + STAssertNotNil(statement, @"Failed to create select statement"); + STAssertEquals(err, SQLITE_OK, @"Failed to create select statement"); - sqlite3_stmt *sqlite3Statment = [statement sqlite3Statement]; + sqlite3_stmt *sqlite3Statment = [statement sqlite3Statement]; - err = [statement stepRow]; - STAssertEquals(err, SQLITE_ROW, - @"failed to step row for finalize test"); + err = [statement stepRow]; + STAssertEquals(err, SQLITE_ROW, + @"failed to step row for finalize test"); - NSString *expectedLog = - @"-[GTMSQLiteStatement finalizeStatement] must be called " - @"when statement is no longer needed"; + NSString *expectedLog = + @"-[GTMSQLiteStatement finalizeStatement] must be called " + @"when statement is no longer needed"; - [GTMUnitTestDevLog expectString:@"%@", expectedLog]; - [GTMUnitTestDevLog expectPattern:@"Unable to close .*"]; - [localPool drain]; - - // Clean up leaks. Since we hadn't finalized the statement above we - // were unable to clean up the sqlite databases. Since the pool is drained - // all of our objective-c objects are gone, so we have to call the - // sqlite3 api directly. - STAssertEquals(sqlite3_finalize(sqlite3Statment), SQLITE_OK, nil); - STAssertEquals(sqlite3_close(sqlite3DB), SQLITE_OK, nil); - } + [GTMUnitTestDevLog expectString:@"%@", expectedLog]; + [GTMUnitTestDevLog expectPattern:@"Unable to close .*"]; + [localPool drain]; + + // Clean up leaks. Since we hadn't finalized the statement above we + // were unable to clean up the sqlite databases. Since the pool is drained + // all of our objective-c objects are gone, so we have to call the + // sqlite3 api directly. + STAssertEquals(sqlite3_finalize(sqlite3Statment), SQLITE_OK, nil); + STAssertEquals(sqlite3_close(sqlite3DB), SQLITE_OK, nil); } - (void)testCompleteSQLString { diff --git a/Foundation/GTMServiceManagementTest.m b/Foundation/GTMServiceManagementTest.m index f23ceba..95ef0b4 100644 --- a/Foundation/GTMServiceManagementTest.m +++ b/Foundation/GTMServiceManagementTest.m @@ -21,7 +21,6 @@ #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 #import "GTMSenTestCase.h" -#import "GTMGarbageCollection.h" #import <servers/bootstrap.h> #define STANDARD_JOB_LABEL "com.apple.launchctl.Background" diff --git a/Foundation/GTMSystemVersion.m b/Foundation/GTMSystemVersion.m index 9bd969c..2a84168 100644 --- a/Foundation/GTMSystemVersion.m +++ b/Foundation/GTMSystemVersion.m @@ -17,7 +17,6 @@ // #import "GTMSystemVersion.h" -#import "GTMGarbageCollection.h" #import "GTMObjC2Runtime.h" #if GTM_MACOS_SDK #import <CoreServices/CoreServices.h> @@ -134,7 +133,6 @@ static NSString *const kSystemVersionPlistPath = @"/System/Library/CoreServices/ NSDictionary *systemVersionPlist = [NSDictionary dictionaryWithContentsOfFile:kSystemVersionPlistPath]; sBuild = [[systemVersionPlist objectForKey:@"ProductBuildVersion"] retain]; - GTMNSMakeUncollectable(sBuild); _GTMDevAssert(sBuild, @"Unable to get build version"); } } diff --git a/Foundation/GTMURITemplate.m b/Foundation/GTMURITemplate.m index 3240dee..7721d84 100644 --- a/Foundation/GTMURITemplate.m +++ b/Foundation/GTMURITemplate.m @@ -15,7 +15,7 @@ #import "GTMURITemplate.h" -#import "GTMGarbageCollection.h" +#import "GTMDefines.h" #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 diff --git a/GTM.xcodeproj/project.pbxproj b/GTM.xcodeproj/project.pbxproj index 3a9024f..e2f6f67 100644 --- a/GTM.xcodeproj/project.pbxproj +++ b/GTM.xcodeproj/project.pbxproj @@ -95,8 +95,6 @@ 8B29078711F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B29078511F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.m */; }; 8B29080911F8E1630064F50F /* GTMNSFileHandle+UniqueName.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B29078511F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.m */; }; 8B29080A11F8E1670064F50F /* GTMNSFileHandle+UniqueName.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B29078411F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8B307FF81056B773006C4C7A /* GTMNSNumber+64Bit.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B307FF61056B773006C4C7A /* GTMNSNumber+64Bit.m */; }; - 8B307FF91056B773006C4C7A /* GTMNSNumber+64Bit.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B307FF71056B773006C4C7A /* GTMNSNumber+64Bit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8B3345890DBF8A55009FD32C /* GTMNSAppleEvent+HandlerTest.applescript in AppleScript */ = {isa = PBXBuildFile; fileRef = 8B3344200DBF7A36009FD32C /* GTMNSAppleEvent+HandlerTest.applescript */; settings = {ATTRIBUTES = (Debug, ); }; }; 8B3590160E8190FA0041E21C /* GTMTestTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B3590150E8190FA0041E21C /* GTMTestTimer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8B35901B0E8191750041E21C /* GTMTestTimerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B35901A0E8191750041E21C /* GTMTestTimerTest.m */; }; @@ -295,7 +293,6 @@ 8BFE6E8D1282371200B5C894 /* GTMNSFileHandle+UniqueNameTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B29078611F8D1BF0064F50F /* GTMNSFileHandle+UniqueNameTest.m */; }; 8BFE6E8E1282371200B5C894 /* GTMNSFileManager+CarbonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8EC87F0EF17C2F0044D13F /* GTMNSFileManager+CarbonTest.m */; }; 8BFE6E8F1282371200B5C894 /* GTMNSFileManager+PathTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F413908E0D75F63C00F72B31 /* GTMNSFileManager+PathTest.m */; }; - 8BFE6E901282371200B5C894 /* GTMNSNumber+64BitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B3080141056B917006C4C7A /* GTMNSNumber+64BitTest.m */; }; 8BFE6E911282371200B5C894 /* GTMNSObject+KeyValueObservingTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B6C161B0F3580DA00E51E5D /* GTMNSObject+KeyValueObservingTest.m */; }; 8BFE6E921282371200B5C894 /* GTMNSScanner+JSONTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BD35B900FB22980009058F5 /* GTMNSScanner+JSONTest.m */; }; 8BFE6E931282371200B5C894 /* GTMNSScanner+UnsignedTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BCB59F211C00EF6009B6C40 /* GTMNSScanner+UnsignedTest.m */; }; @@ -347,7 +344,6 @@ F42E09450D199BA400D5DDE0 /* GTMNSObject+UnitTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = F48FE29C0D198D36009257D2 /* GTMNSObject+UnitTesting.m */; }; F42E09490D199BBF00D5DDE0 /* GTMDelegatingTableColumn.h in Headers */ = {isa = PBXBuildFile; fileRef = F48FE27C0D198D0E009257D2 /* GTMDelegatingTableColumn.h */; settings = {ATTRIBUTES = (Public, ); }; }; F42E094A0D199BBF00D5DDE0 /* GTMDelegatingTableColumn.m in Sources */ = {isa = PBXBuildFile; fileRef = F48FE27D0D198D0E009257D2 /* GTMDelegatingTableColumn.m */; }; - F42E094B0D199BBF00D5DDE0 /* GTMGarbageCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = F48FE28D0D198D24009257D2 /* GTMGarbageCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; F42E094C0D199BBF00D5DDE0 /* GTMGeometryUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F48FE27E0D198D0E009257D2 /* GTMGeometryUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; F42E094D0D199BBF00D5DDE0 /* GTMGeometryUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F48FE27F0D198D0E009257D2 /* GTMGeometryUtils.m */; }; F42E094F0D199BBF00D5DDE0 /* GTMNSBezierPath+RoundRect.h in Headers */ = {isa = PBXBuildFile; fileRef = F48FE2810D198D0E009257D2 /* GTMNSBezierPath+RoundRect.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -644,9 +640,6 @@ 8B29078411F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSFileHandle+UniqueName.h"; sourceTree = "<group>"; }; 8B29078511F8D1BF0064F50F /* GTMNSFileHandle+UniqueName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSFileHandle+UniqueName.m"; sourceTree = "<group>"; }; 8B29078611F8D1BF0064F50F /* GTMNSFileHandle+UniqueNameTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSFileHandle+UniqueNameTest.m"; sourceTree = "<group>"; }; - 8B307FF61056B773006C4C7A /* GTMNSNumber+64Bit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSNumber+64Bit.m"; sourceTree = "<group>"; }; - 8B307FF71056B773006C4C7A /* GTMNSNumber+64Bit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSNumber+64Bit.h"; sourceTree = "<group>"; }; - 8B3080141056B917006C4C7A /* GTMNSNumber+64BitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSNumber+64BitTest.m"; sourceTree = "<group>"; }; 8B3344170DBF7A36009FD32C /* GTMNSAppleScript+HandlerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSAppleScript+HandlerTest.m"; sourceTree = "<group>"; }; 8B3344180DBF7A36009FD32C /* GTMNSAppleScript+Handler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSAppleScript+Handler.m"; sourceTree = "<group>"; }; 8B3344190DBF7A36009FD32C /* GTMNSAppleScript+Handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSAppleScript+Handler.h"; sourceTree = "<group>"; }; @@ -944,7 +937,6 @@ F48FE2810D198D0E009257D2 /* GTMNSBezierPath+RoundRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSBezierPath+RoundRect.h"; sourceTree = "<group>"; }; F48FE2820D198D0E009257D2 /* GTMNSBezierPath+RoundRect.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSBezierPath+RoundRect.m"; sourceTree = "<group>"; }; F48FE2830D198D0E009257D2 /* GTMNSBezierPath+RoundRectTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSBezierPath+RoundRectTest.m"; sourceTree = "<group>"; }; - F48FE28D0D198D24009257D2 /* GTMGarbageCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTMGarbageCollection.h; sourceTree = "<group>"; }; F48FE28E0D198D24009257D2 /* GTMNSString+HTML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTMNSString+HTML.h"; sourceTree = "<group>"; }; F48FE28F0D198D24009257D2 /* GTMNSString+HTML.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSString+HTML.m"; sourceTree = "<group>"; }; F48FE2900D198D24009257D2 /* GTMNSString+HTMLTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTMNSString+HTMLTest.m"; sourceTree = "<group>"; }; @@ -1544,7 +1536,6 @@ F47F1D2D0D4914AD00925B8F /* GTMCalculatedRange.h */, F47F1D2E0D4914AD00925B8F /* GTMCalculatedRange.m */, F47F1D2F0D4914AD00925B8F /* GTMCalculatedRangeTest.m */, - F48FE28D0D198D24009257D2 /* GTMGarbageCollection.h */, F41711320ECDFBD500B9B276 /* GTMLightweightProxy.h */, F41711330ECDFBD500B9B276 /* GTMLightweightProxy.m */, F41711340ECDFBD500B9B276 /* GTMLightweightProxyTest.m */, @@ -1577,9 +1568,6 @@ F413908C0D75F63C00F72B31 /* GTMNSFileManager+Path.h */, F413908D0D75F63C00F72B31 /* GTMNSFileManager+Path.m */, F413908E0D75F63C00F72B31 /* GTMNSFileManager+PathTest.m */, - 8B307FF71056B773006C4C7A /* GTMNSNumber+64Bit.h */, - 8B307FF61056B773006C4C7A /* GTMNSNumber+64Bit.m */, - 8B3080141056B917006C4C7A /* GTMNSNumber+64BitTest.m */, 8B6C15910F356E6400E51E5D /* GTMNSObject+KeyValueObserving.h */, 8B6C15920F356E6400E51E5D /* GTMNSObject+KeyValueObserving.m */, 8B6C161B0F3580DA00E51E5D /* GTMNSObject+KeyValueObservingTest.m */, @@ -1735,7 +1723,6 @@ 0BFAD4C8104D06EF002BEB27 /* GTMNSDictionary+CaseInsensitive.h in Headers */, F93207DE0F4B82DB005F37EA /* GTMSQLite.h in Headers */, F42E09490D199BBF00D5DDE0 /* GTMDelegatingTableColumn.h in Headers */, - F42E094B0D199BBF00D5DDE0 /* GTMGarbageCollection.h in Headers */, F42E094C0D199BBF00D5DDE0 /* GTMGeometryUtils.h in Headers */, F42E094F0D199BBF00D5DDE0 /* GTMNSBezierPath+RoundRect.h in Headers */, F42E09510D199BBF00D5DDE0 /* GTMNSString+HTML.h in Headers */, @@ -1796,7 +1783,6 @@ F43C7A571021FAA300ABF03C /* GTMUILocalizerAndLayoutTweaker.h in Headers */, 7F97DB32104EBCA0004DDDEE /* GTMFadeTruncatingTextFieldCell.h in Headers */, 7FF768E41051B17E00D34F4B /* GTMNSImage+SearchCache.h in Headers */, - 8B307FF91056B773006C4C7A /* GTMNSNumber+64Bit.h in Headers */, F4C6248B109753960069CADD /* GTMIBArray.h in Headers */, 8B158ADE10A8C42000C93125 /* GTMNSAnimation+Duration.h in Headers */, 8BF2555310F65B56000490C8 /* GTMTypeCasting.h in Headers */, @@ -2348,7 +2334,6 @@ 8BFE6E8D1282371200B5C894 /* GTMNSFileHandle+UniqueNameTest.m in Sources */, 8BFE6E8E1282371200B5C894 /* GTMNSFileManager+CarbonTest.m in Sources */, 8BFE6E8F1282371200B5C894 /* GTMNSFileManager+PathTest.m in Sources */, - 8BFE6E901282371200B5C894 /* GTMNSNumber+64BitTest.m in Sources */, 8BFE6E911282371200B5C894 /* GTMNSObject+KeyValueObservingTest.m in Sources */, 8BFE6E921282371200B5C894 /* GTMNSScanner+JSONTest.m in Sources */, 8BFE6E931282371200B5C894 /* GTMNSScanner+UnsignedTest.m in Sources */, @@ -2438,7 +2423,6 @@ 7F97DB33104EBCA3004DDDEE /* GTMFadeTruncatingTextFieldCell.m in Sources */, 0BFAD4C9104D06EF002BEB27 /* GTMNSDictionary+CaseInsensitive.m in Sources */, 7FF768E51051B17E00D34F4B /* GTMNSImage+SearchCache.m in Sources */, - 8B307FF81056B773006C4C7A /* GTMNSNumber+64Bit.m in Sources */, F4C6248C109753960069CADD /* GTMIBArray.m in Sources */, 8B158A9B10A8C31100C93125 /* GTMNSAnimation+Duration.m in Sources */, 0B1B9B8810FECD870084EE4B /* GTMStringEncoding.m in Sources */, diff --git a/GTMDefines.h b/GTMDefines.h index c295848..db7a04d 100644 --- a/GTMDefines.h +++ b/GTMDefines.h @@ -371,6 +371,14 @@ #endif #endif +#ifndef GTMCFAutorelease + #if __has_feature(objc_arc) + #define GTMCFAutorelease(x) CFBridgingRelease(x) + #else + #define GTMCFAutorelease(x) ([(id)x autorelease]) + #endif +#endif + #ifdef __OBJC__ // Declared here so that it can easily be used for logging tracking if diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 41b16d9..5beaf2d 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -30,6 +30,8 @@ Changes since 1.6.0 - Removed support for Garbage Collection, leaving just the shell for other code that might have depended on some of the constants/method GTM provided. +- Removed GTMNSNumber+64Bit methods as obsolete. + Release 1.6.0 Changes since 1.5.1 diff --git a/UnitTesting/GTMAppKit+UnitTesting.m b/UnitTesting/GTMAppKit+UnitTesting.m index 02e0e30..5b4d6f7 100644 --- a/UnitTesting/GTMAppKit+UnitTesting.m +++ b/UnitTesting/GTMAppKit+UnitTesting.m @@ -22,7 +22,6 @@ #import "GTMAppKit+UnitTesting.h" #import "GTMGeometryUtils.h" #import "GTMMethodCheck.h" -#import "GTMGarbageCollection.h" #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 #define ENCODE_NSINTEGER(coder, i, key) [(coder) encodeInt:(i) forKey:(key)] diff --git a/UnitTesting/GTMAppKitUnitTestingUtilities.m b/UnitTesting/GTMAppKitUnitTestingUtilities.m index 5d87541..71c4d76 100644 --- a/UnitTesting/GTMAppKitUnitTestingUtilities.m +++ b/UnitTesting/GTMAppKitUnitTestingUtilities.m @@ -21,7 +21,6 @@ #include <signal.h> #include <unistd.h> #import "GTMDefines.h" -#import "GTMGarbageCollection.h" // The Users profile before we change it on them static CMProfileRef gGTMCurrentColorProfile = NULL; diff --git a/UnitTesting/GTMCALayer+UnitTesting.m b/UnitTesting/GTMCALayer+UnitTesting.m index 3ffa209..52367e5 100644 --- a/UnitTesting/GTMCALayer+UnitTesting.m +++ b/UnitTesting/GTMCALayer+UnitTesting.m @@ -21,7 +21,6 @@ // #import "GTMCALayer+UnitTesting.h" -#import "GTMGarbageCollection.h" @implementation CALayer (GTMUnitTestingAdditions) diff --git a/UnitTesting/GTMNSObject+UnitTesting.m b/UnitTesting/GTMNSObject+UnitTesting.m index df75f14..209b9b2 100644 --- a/UnitTesting/GTMNSObject+UnitTesting.m +++ b/UnitTesting/GTMNSObject+UnitTesting.m @@ -20,8 +20,6 @@ #import "GTMNSObject+UnitTesting.h" #import "GTMSystemVersion.h" -#import "GTMGarbageCollection.h" -#import "GTMNSNumber+64Bit.h" #if GTM_IPHONE_SDK #import <UIKit/UIKit.h> diff --git a/UnitTesting/GTMSenTestCase.m b/UnitTesting/GTMSenTestCase.m index 088514c..fab3ee0 100644 --- a/UnitTesting/GTMSenTestCase.m +++ b/UnitTesting/GTMSenTestCase.m @@ -28,8 +28,6 @@ #if GTM_IPHONE_SDK #import <UIKit/UIKit.h> -#else -#import "GTMGarbageCollection.h" #endif // GTM_IPHONE_SDK #if GTM_IPHONE_SDK && !GTM_IPHONE_USE_SENTEST @@ -488,25 +486,19 @@ static void _GTMRunLeaks(void) { // COV_NF_END static __attribute__((constructor)) void _GTMInstallLeaks(void) { - BOOL checkLeaks = YES; -#if !GTM_IPHONE_SDK - checkLeaks = GTMIsGarbageCollectionEnabled() ? NO : YES; -#endif // !GTM_IPHONE_SDK + BOOL checkLeaks = getenv("GTM_ENABLE_LEAKS") ? YES : NO; if (checkLeaks) { - checkLeaks = getenv("GTM_ENABLE_LEAKS") ? YES : NO; - if (checkLeaks) { - // COV_NF_START - // We don't have leak checking on by default, so this won't be hit. - fprintf(stderr, "Leak Checking Enabled\n"); - fflush(stderr); - int ret = atexit(&_GTMRunLeaks); - // To avoid unused variable warning when _GTMDevAssert is stripped. - (void)ret; - _GTMDevAssert(ret == 0, - @"Unable to install _GTMRunLeaks as an atexit handler (%d)", - errno); - // COV_NF_END - } + // COV_NF_START + // We don't have leak checking on by default, so this won't be hit. + fprintf(stderr, "Leak Checking Enabled\n"); + fflush(stderr); + int ret = atexit(&_GTMRunLeaks); + // To avoid unused variable warning when _GTMDevAssert is stripped. + (void)ret; + _GTMDevAssert(ret == 0, + @"Unable to install _GTMRunLeaks as an atexit handler (%d)", + errno); + // COV_NF_END } } diff --git a/XcodeConfig/Target/LoadableBundleGCSupported.xcconfig b/XcodeConfig/Target/LoadableBundleGCSupported.xcconfig deleted file mode 100644 index aa8d5a7..0000000 --- a/XcodeConfig/Target/LoadableBundleGCSupported.xcconfig +++ /dev/null @@ -1,30 +0,0 @@ -// -// LoadableBundleGCSupported.xcconfig -// -// Xcode configuration file for a loadable bundle target that supports garbage -// collection. Usually a Cocoa plugin or similar. -// -// This is a _Target_ config file, for use in the "Based on" popup of the -// settings dialog for a target. Do not attempt to apply this as the base -// of an Xcode configuration in the project settings dialog. -// -// Copyright 2006-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// Include the basic Loadable Bundle config -#include "LoadableBundle.xcconfig" - -// Include the GC flag(s) -#include "../subconfig/GCSupported.xcconfig" diff --git a/XcodeConfig/Target/SharedLibraryGCSupported.xcconfig b/XcodeConfig/Target/SharedLibraryGCSupported.xcconfig deleted file mode 100644 index 74ab907..0000000 --- a/XcodeConfig/Target/SharedLibraryGCSupported.xcconfig +++ /dev/null @@ -1,30 +0,0 @@ -// -// SharedLibraryGCSupported.xcconfig -// -// Xcode configuration file for a shared library target that support garbage -// collection. -// -// This is a _Target_ config file, for use in the "Based on" popup of the -// settings dialog for a target. Do not attempt to apply this as the base -// of an Xcode configuration in the project settings dialog. -// -// Copyright 2006-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// Include the basic Shared Library config -#include "SharedLibrary.xcconfig" - -// Include the GC flag(s) -#include "../subconfig/GCSupported.xcconfig" diff --git a/XcodeConfig/Target/StaticLibraryGCSupported.xcconfig b/XcodeConfig/Target/StaticLibraryGCSupported.xcconfig deleted file mode 100644 index 07ea1d5..0000000 --- a/XcodeConfig/Target/StaticLibraryGCSupported.xcconfig +++ /dev/null @@ -1,30 +0,0 @@ -// -// StaticLibraryGCSupported.xcconfig -// -// Xcode configuration file for a static library target that supports garbage -// collection. -// -// This is a _Target_ config file, for use in the "Based on" popup of the -// settings dialog for a target. Do not attempt to apply this as the base -// of an Xcode configuration in the project settings dialog. -// -// Copyright 2006-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// Include the basic Static Library config -#include "StaticLibrary.xcconfig" - -// Include the GC flag(s) -#include "../subconfig/GCSupported.xcconfig" diff --git a/XcodeConfig/subconfig/GCSupported.xcconfig b/XcodeConfig/subconfig/GCSupported.xcconfig deleted file mode 100644 index 74bd027..0000000 --- a/XcodeConfig/subconfig/GCSupported.xcconfig +++ /dev/null @@ -1,23 +0,0 @@ -// -// GCSupported.xcconfig -// -// Xcode configuration file for making a build Garbage Collection enabled. -// Use the *GCSupported specific configs in the Target folder. -// -// Copyright 2006-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -// enable garbage collection (but don't require it) -GCC_ENABLE_OBJC_GC = supported |