Skip to content

Commit

Permalink
Add ARC support checks to the entire codebase.
Browse files Browse the repository at this point in the history
It appears that people have been adding Nimbus to non-ARC projects
and experiencing memory leaks.
  • Loading branch information
jverkoey committed Jul 24, 2012
1 parent 2abe9f5 commit 4134612
Show file tree
Hide file tree
Showing 72 changed files with 266 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/attributedlabel/src/NIAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#import "NSMutableAttributedString+NimbusAttributedLabel.h"
#import <QuartzCore/QuartzCore.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static const CGFloat kVMargin = 5.0f;
static const NSTimeInterval kLongPressTimeInterval = 0.5;
static const CGFloat kLongPressGutter = 22;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(NSAttributedStringNimbusAttributedLabel)

///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 4 additions & 0 deletions src/badge/src/NIBadgeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#import "NimbusCore.h" // For NIScreenScale

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static const CGFloat kMinimumWidth = 30.f;
static const CGFloat kHorizontalMargins = 20.f;
static const CGFloat kVerticalMargins = 10.f;
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NICommonMetrics.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NISDKAvailability.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
CGFloat NIToolbarHeightForOrientation(UIInterfaceOrientation orientation) {
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NIDataStructures.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#import "NIDebuggingTools.h"
#import "NIPreprocessorMacros.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

// The internal representation of a single node.
@interface NILinkedListNode : NSObject
@property (nonatomic, readwrite, retain) id object;
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NIDebuggingTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#import "NIDebuggingTools.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NSInteger NIMaxLogLevel = NILOGLEVEL_WARNING;
BOOL NIDebugAssertionsShouldBreak = YES;

Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NIDeviceOrientation.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#import "NIDebuggingTools.h"
#import "NISDKAvailability.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
BOOL NIIsSupportedOrientation(UIInterfaceOrientation orientation) {
Expand Down
5 changes: 4 additions & 1 deletion src/core/src/NIError.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

#import "NIError.h"

NSString* const NINimbusErrorDomain = @"com.nimbus.error";
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NSString* const NINimbusErrorDomain = @"com.nimbus.error";
NSString* const NIImageErrorKey = @"image";
3 changes: 3 additions & 0 deletions src/core/src/NIFoundationMethods.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NIDebuggingTools.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NIInMemoryCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

#import <UIKit/UIKit.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

@interface NIMemoryCache()
// Mapping from a name (usually a URL) to an internal object.
@property (nonatomic, readwrite, retain) NSMutableDictionary* cacheMap;
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NINavigationAppearance.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#import "NIDebuggingTools.h"
#import "NISDKAvailability.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static NSMutableArray* sAppearanceStack = nil;

/**
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NINetworkActivity.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#import <pthread.h>
#import <UIKit/UIKit.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static int gNetworkTaskCount = 0;
static pthread_mutex_t gMutex = PTHREAD_MUTEX_INITIALIZER;
static const NSTimeInterval kDelayBeforeDisablingActivity = 0.1;
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NINonEmptyCollectionTesting.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NINonEmptyCollectionTesting.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
BOOL NIIsArrayWithObjects(id object) {
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NINonRetainingCollections.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NINonRetainingCollections.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
NSMutableArray* NICreateNonRetainingMutableArray(void) {
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NIOperations.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#import "NIPreprocessorMacros.h"
#import "NIOperations+Subclassing.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NIPaths.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NIPaths.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
NSString* NIPathForBundleResource(NSBundle* bundle, NSString* relativePath) {
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NIRuntimeClassModifications.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

#import <objc/runtime.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
void NISwapInstanceMethods(Class cls, SEL originalSel, SEL newSel) {
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NISDKAvailability.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
BOOL NIIsPad(void) {
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NIState.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#import "NIInMemoryCache.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static NIImageMemoryCache* sNimbusGlobalMemoryCache = nil;
static NSOperationQueue* sNimbusGlobalOperationQueue = nil;

Expand Down
4 changes: 4 additions & 0 deletions src/core/src/NIViewRecycler.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

@interface NIViewRecycler()
@property (nonatomic, readwrite, retain) NSMutableDictionary* reuseIdentifiersToRecycledViews;
@end
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NSData+NimbusCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#import <CommonCrypto/CommonDigest.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/NSString+NimbusCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#import <UIKit/UIKit.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 3 additions & 0 deletions src/core/src/UIView+NimbusCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

#import "NIPreprocessorMacros.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 4 additions & 0 deletions src/css/src/CSSTokens.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
// limitations under the License.
//

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

const char* cssnames[] = {
"STRING",
"IDENT",
Expand Down
4 changes: 4 additions & 0 deletions src/css/src/NICSSParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#import <pthread.h>

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static pthread_mutex_t gMutex = PTHREAD_MUTEX_INITIALIZER;
NSString* const kPropertyOrderKey = @"__kRuleSetOrder__";
NSString* const kDependenciesSelectorKey = @"__kDependencies__";
Expand Down
4 changes: 4 additions & 0 deletions src/css/src/NICSSRuleset.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#import "NICSSParser.h"
#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static NSString* const kTextColorKey = @"color";
static NSString* const kTextAlignmentKey = @"text-align";
static NSString* const kFontKey = @"font";
Expand Down
4 changes: 4 additions & 0 deletions src/css/src/NIChameleonObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#import "NimbusCore+Additions.h"
#import "AFNetworking.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

static NSString* const kWatchFilenameKey = @"___watch___";
static const NSTimeInterval kTimeoutInterval = 1000;
static const NSInteger kMaxNumberOfRetries = 3;
Expand Down
3 changes: 3 additions & 0 deletions src/css/src/NIDOM.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#import "NIStylesheet.h"
#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 4 additions & 0 deletions src/css/src/NIStylesheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#import "NIStyleable.h"
#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NSString* const NIStylesheetDidChangeNotification = @"NIStylesheetDidChangeNotification";

@interface NIStylesheet()
Expand Down
3 changes: 3 additions & 0 deletions src/css/src/NIStylesheetCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#import "NIStylesheet.h"
#import "NimbusCore.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UIActivityIndicatorView+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UIActivityIndicatorView_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UIActivityIndicatorView_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UIButton+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UIButton_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UIButton_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UILabel+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UILabel_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UILabel_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UINavigationBar+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UINavigationBar_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UINavigationBar_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UIScrollView+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UIScrollView_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UIScrollView_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion src/css/src/UISearchBar+NIStyleable.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@
#import "NICSSRuleset.h"
#import "NimbusCore.h"

NI_FIX_CATEGORY_BUG(UISearchBar_NIStyleable)
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "Nimbus requires ARC support."
#endif

NI_FIX_CATEGORY_BUG(UISearchBar_NIStyleable)

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading

0 comments on commit 4134612

Please sign in to comment.