Permalink
Browse files

Merged from pull request

  • Loading branch information...
2 parents 10a3fec + 18d984e commit c8ffde36b4a3948b0d66b16e8c2387d3a98e7123 @casademora casademora committed Dec 6, 2011
@@ -34,11 +34,9 @@ + (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator];
[defaultManageObjectContext_ MR_stopObservingiCloudChangesInCoordinator:coordinator];
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
- [moc retain];
- [defaultManageObjectContext_ release];
-#endif
-
+ MR_RETAIN(moc);
+ MR_RELEASE(defaultManageObjectContext_);
+
defaultManageObjectContext_ = moc;
[defaultManageObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator];
}
@@ -182,7 +180,7 @@ - (BOOL) MR_saveWithErrorHandler:(void (^)(NSError *))errorCallback;
- (void) MR_saveWrapper;
{
-#ifdef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
+#if MR_USE_ARC
@autoreleasepool
{
[self MR_save];
@@ -25,10 +25,8 @@ + (NSManagedObjectModel *) MR_defaultManagedObjectModel
+ (void) MR_setDefaultManagedObjectModel:(NSManagedObjectModel *)newDefaultModel
{
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
- [newDefaultModel retain];
- [defaultManagedObjectModel_ release];
-#endif
+ MR_RETAIN(newDefaultModel);
+ MR_RELEASE(defaultManagedObjectModel_);
defaultManagedObjectModel_ = newDefaultModel;
}
@@ -22,10 +22,8 @@ + (NSPersistentStore *) MR_defaultPersistentStore
+ (void) MR_setDefaultPersistentStore:(NSPersistentStore *) store
{
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
- [store retain];
- [defaultPersistentStore_ release];
-#endif
+ MR_RETAIN(store);
+ MR_RELEASE(defaultPersistentStore_);
defaultPersistentStore_ = store;
}
@@ -29,10 +29,8 @@ + (NSPersistentStoreCoordinator *) MR_defaultStoreCoordinator
+ (void) MR_setDefaultStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator
{
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
- [coordinator retain];
- [defaultCoordinator_ release];
-#endif
+ MR_RETAIN(coordinator);
+ MR_RELEASE(defaultCoordinator_);
defaultCoordinator_ = coordinator;
if (defaultCoordinator_ != nil)
@@ -18,14 +18,18 @@
#import <CoreData/CoreData.h>
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
-#define MR_RETAIN(xx) [xx retain];
-#define MR_RELEASE(xx) [xx release];
-#define MR_AUTORELEASE(xx) [xx autorelease];
-#else
+#ifndef MR_USE_ARC
+#define MR_USE_ARC 1
+#endif
+
+#if MR_USE_ARC
#define MR_RETAIN(xx) ((void)0)
#define MR_RELEASE(xx) ((void)0)
#define MR_AUTORELEASE(xx) ((void)0)
+#else
+#define MR_RETAIN(xx) [xx retain];
+#define MR_RELEASE(xx) [xx release];
+#define MR_AUTORELEASE(xx) [xx autorelease];
#endif
#ifdef MR_SHORTHAND
@@ -421,9 +421,7 @@ BOOL addMagicalRecordShortHandMethodToPrefixedClassMethod(Class klass, SEL origi
[formatter setDateFormat:format];
NSDate *parsedDate = [formatter dateFromString:value];
-#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
- [formatter autorelease];
-#endif
+ MR_AUTORELEASE(formatter);
return parsedDate;
}

0 comments on commit c8ffde3

Please sign in to comment.