diff options
Diffstat (limited to 'Source/SPArrayAdditions.h')
-rw-r--r-- | Source/SPArrayAdditions.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/SPArrayAdditions.h b/Source/SPArrayAdditions.h index 31493f22..eb11da02 100644 --- a/Source/SPArrayAdditions.h +++ b/Source/SPArrayAdditions.h @@ -27,12 +27,11 @@ static inline id NSArrayObjectAtIndex(NSArray* self, NSUInteger i) { return (id)CFArrayGetValueAtIndex((CFArrayRef)self, i); } - static inline void NSMutableArrayAddObject(NSArray* self, id anObject) { - typedef void (*SPMutableArrayAddObjectMethodPtr)(NSArray*, SEL, id); - static SPMutableArrayAddObjectMethodPtr SPNSMutableArrayAddObject; - if (!SPNSMutableArrayAddObject) SPNSMutableArrayAddObject = (SPMutableArrayAddObjectMethodPtr)[self methodForSelector:@selector(addObject:)]; - SPNSMutableArrayAddObject(self, @selector(addObject:), anObject); + CFArrayAppendValue((CFMutableArrayRef)self, anObject); +} +static inline void NSMutableArrayReplaceObject(NSArray* self, CFIndex idx, id anObject) { + CFArraySetValueAtIndex((CFMutableArrayRef)self, idx, anObject); } @interface NSArray (SPArrayAdditions) |