From cbb32e4e27b4bbff638fa2f3d35b6ba53ab0d20c Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 15 Nov 2010 12:06:18 -0800 Subject: Remove the obsolete (and sometimes dangerously optimized) -[NSMutableArray(Radix) radixSortUsingSelector:withObject:]. --- MobileCydia.mm | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'MobileCydia.mm') diff --git a/MobileCydia.mm b/MobileCydia.mm index 43a3053..6dd79d2 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -411,7 +411,6 @@ static const CFStringCompareFlags LaxCompareFlags_ = kCFCompareCaseInsensitive | typedef uint32_t (*SKRadixFunction)(id, void *); @interface NSMutableArray (Radix) -- (void) radixSortUsingSelector:(SEL)selector withObject:(id)object; - (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument; @end @@ -472,43 +471,6 @@ static void RadixSort_(NSMutableArray *self, size_t count, struct RadixItem_ *sw @implementation NSMutableArray (Radix) -- (void) radixSortUsingSelector:(SEL)selector withObject:(id)object { - size_t count([self count]); - if (count == 0) - return; - -#if 0 - NSInvocation *invocation([NSInvocation invocationWithMethodSignature:[NSMethodSignature signatureWithObjCTypes:"L12@0:4@8"]]); - [invocation setSelector:selector]; - [invocation setArgument:&object atIndex:2]; -#else - /* XXX: this is an unsafe optimization of doomy hell */ - Method method(class_getInstanceMethod([[self objectAtIndex:0] class], selector)); - _assert(method != NULL); - uint32_t (*imp)(id, SEL, id) = reinterpret_cast(method_getImplementation(method)); - _assert(imp != NULL); -#endif - - struct RadixItem_ *swap(new RadixItem_[count * 2]); - - for (size_t i(0); i != count; ++i) { - RadixItem_ &item(swap[i]); - item.index = i; - - id object([self objectAtIndex:i]); - -#if 0 - [invocation setTarget:object]; - [invocation invoke]; - [invocation getReturnValue:&item.key]; -#else - item.key = imp(object, selector, object); -#endif - } - - RadixSort_(self, count, swap); -} - - (void) radixSortUsingFunction:(SKRadixFunction)function withContext:(void *)argument { size_t count([self count]); struct RadixItem_ *swap(new RadixItem_[count * 2]); -- cgit v1.2.3