mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@91439 d073be05-634f-4543-b044-5fe20cf6d1d6
37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
--- NSObject+Extensions.m.orig 2003-12-15 15:17:28.000000000 +1100
|
|
+++ NSObject+Extensions.m 2012-04-02 10:04:35.000000000 +1000
|
|
@@ -89,22 +89,23 @@ IMP EDGetFirstUnusedIMPForSelector(Class
|
|
{
|
|
#ifndef GNU_RUNTIME
|
|
IMP activeIMP;
|
|
- struct objc_method_list *mlist;
|
|
void *iterator;
|
|
int i;
|
|
-
|
|
+ Method *methlist;
|
|
+ int count;
|
|
+
|
|
if(isClassMethod)
|
|
aClass = aClass->isa;
|
|
iterator = 0;
|
|
activeIMP = [aClass instanceMethodForSelector:aSelector];
|
|
- while((mlist = class_nextMethodList(aClass, &iterator)) != NULL)
|
|
- {
|
|
- for(i = 0; i < mlist->method_count; i++)
|
|
- {
|
|
- if((mlist->method_list[i].method_name == aSelector) && (mlist->method_list[i].method_imp != activeIMP))
|
|
- return mlist->method_list[i].method_imp;
|
|
- }
|
|
- }
|
|
+ methlist = class_copyMethodList(aClass, &count);
|
|
+ for (i = 0; i < count; i++) {
|
|
+ if((method_getName(methlist[i]) == aSelector) && (method_getImplementation(methlist[i]) != activeIMP)) {
|
|
+ IMP unused = method_getImplementation(methlist[i]);
|
|
+ free(methlist);
|
|
+ }
|
|
+ }
|
|
+ free(methlist);
|
|
return NULL;
|
|
#else /* GNU_RUNTIME */
|
|
#warning ** implementation missing for GNU runtime
|