mirror of
https://github.com/zhigang1992/MagicalRecord.git
synced 2026-01-12 17:32:18 +08:00
use the MR_RETAIN/MR_RELEASE/MR_AUTORELEASE macros everywhere
This commit is contained in:
@@ -31,10 +31,8 @@ NSString * const kMagicalRecordDidMergeChangesFromiCloudNotification = @"kMagica
|
||||
|
||||
+ (void) MR_setDefaultContext:(NSManagedObjectContext *)moc
|
||||
{
|
||||
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
|
||||
[moc retain];
|
||||
[defaultManageObjectContext_ release];
|
||||
#endif
|
||||
MR_RETAIN(moc);
|
||||
MR_RELEASE(defaultManageObjectContext_);
|
||||
defaultManageObjectContext_ = moc;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,8 @@ static NSManagedObjectModel *defaultManagedObjectModel_ = nil;
|
||||
|
||||
+ (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 @@ static NSPersistentStore *defaultPersistentStore_ = nil;
|
||||
|
||||
+ (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 @@ NSString * const kMagicalRecordPSCDidCompleteiCloudSetupNotification = @"kMagica
|
||||
|
||||
+ (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)
|
||||
|
||||
@@ -417,9 +417,7 @@ NSDate * dateFromString(NSString *value, NSString *format)
|
||||
[formatter setDateFormat:format];
|
||||
|
||||
NSDate *parsedDate = [formatter dateFromString:value];
|
||||
#ifndef NS_AUTOMATED_REFCOUNT_UNAVAILABLE
|
||||
[formatter autorelease];
|
||||
#endif
|
||||
MR_AUTORELEASE(formatter);
|
||||
|
||||
return parsedDate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user