Skip to content

Commit

Permalink
Merged from pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
casademora committed Dec 6, 2011
2 parents 10a3fec + 18d984e commit c8ffde3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
10 changes: 4 additions & 6 deletions Source/Categories/NSManagedObjectContext+MagicalRecord.m
Expand Up @@ -34,11 +34,9 @@ + (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator]; NSPersistentStoreCoordinator *coordinator = [NSPersistentStoreCoordinator MR_defaultStoreCoordinator];
[defaultManageObjectContext_ MR_stopObservingiCloudChangesInCoordinator:coordinator]; [defaultManageObjectContext_ MR_stopObservingiCloudChangesInCoordinator:coordinator];


#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE MR_RETAIN(moc);
[moc retain]; MR_RELEASE(defaultManageObjectContext_);
[defaultManageObjectContext_ release];
#endif

defaultManageObjectContext_ = moc; defaultManageObjectContext_ = moc;
[defaultManageObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator]; [defaultManageObjectContext_ MR_observeiCloudChangesInCoordinator:coordinator];
} }
Expand Down Expand Up @@ -182,7 +180,7 @@ - (BOOL) MR_saveWithErrorHandler:(void (^)(NSError *))errorCallback;


- (void) MR_saveWrapper; - (void) MR_saveWrapper;
{ {
#ifdef NS_AUTOMATED_REFCOUNT_UNAVAILABLE #if MR_USE_ARC
@autoreleasepool @autoreleasepool
{ {
[self MR_save]; [self MR_save];
Expand Down
6 changes: 2 additions & 4 deletions Source/Categories/NSManagedObjectModel+MagicalRecord.m
Expand Up @@ -25,10 +25,8 @@ + (NSManagedObjectModel *) MR_defaultManagedObjectModel


+ (void) MR_setDefaultManagedObjectModel:(NSManagedObjectModel *)newDefaultModel + (void) MR_setDefaultManagedObjectModel:(NSManagedObjectModel *)newDefaultModel
{ {
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE MR_RETAIN(newDefaultModel);
[newDefaultModel retain]; MR_RELEASE(defaultManagedObjectModel_);
[defaultManagedObjectModel_ release];
#endif
defaultManagedObjectModel_ = newDefaultModel; defaultManagedObjectModel_ = newDefaultModel;
} }


Expand Down
6 changes: 2 additions & 4 deletions Source/Categories/NSPersistentStore+MagicalRecord.m
Expand Up @@ -22,10 +22,8 @@ + (NSPersistentStore *) MR_defaultPersistentStore


+ (void) MR_setDefaultPersistentStore:(NSPersistentStore *) store + (void) MR_setDefaultPersistentStore:(NSPersistentStore *) store
{ {
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE MR_RETAIN(store);
[store retain]; MR_RELEASE(defaultPersistentStore_);
[defaultPersistentStore_ release];
#endif
defaultPersistentStore_ = store; defaultPersistentStore_ = store;
} }


Expand Down
Expand Up @@ -29,10 +29,8 @@ + (NSPersistentStoreCoordinator *) MR_defaultStoreCoordinator


+ (void) MR_setDefaultStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator + (void) MR_setDefaultStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator
{ {
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE MR_RETAIN(coordinator);
[coordinator retain]; MR_RELEASE(defaultCoordinator_);
[defaultCoordinator_ release];
#endif
defaultCoordinator_ = coordinator; defaultCoordinator_ = coordinator;


if (defaultCoordinator_ != nil) if (defaultCoordinator_ != nil)
Expand Down
14 changes: 9 additions & 5 deletions Source/CoreData+MagicalRecord.h
Expand Up @@ -18,14 +18,18 @@


#import <CoreData/CoreData.h> #import <CoreData/CoreData.h>


#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE #ifndef MR_USE_ARC
#define MR_RETAIN(xx) [xx retain]; #define MR_USE_ARC 1
#define MR_RELEASE(xx) [xx release]; #endif
#define MR_AUTORELEASE(xx) [xx autorelease];
#else #if MR_USE_ARC
#define MR_RETAIN(xx) ((void)0) #define MR_RETAIN(xx) ((void)0)
#define MR_RELEASE(xx) ((void)0) #define MR_RELEASE(xx) ((void)0)
#define MR_AUTORELEASE(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 #endif


#ifdef MR_SHORTHAND #ifdef MR_SHORTHAND
Expand Down
4 changes: 1 addition & 3 deletions Source/MagicalRecordHelpers.m
Expand Up @@ -421,9 +421,7 @@ BOOL addMagicalRecordShortHandMethodToPrefixedClassMethod(Class klass, SEL origi
[formatter setDateFormat:format]; [formatter setDateFormat:format];


NSDate *parsedDate = [formatter dateFromString:value]; NSDate *parsedDate = [formatter dateFromString:value];
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE MR_AUTORELEASE(formatter);
[formatter autorelease];
#endif


return parsedDate; return parsedDate;
} }
Expand Down

0 comments on commit c8ffde3

Please sign in to comment.