mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
use new runtime api for setter methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29838 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b730fa45c0
commit
e08da453bc
2 changed files with 14 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2010-03-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSKeyValueObserving.m: use class_addMethod() to add setters
|
||||
to replacement class.
|
||||
|
||||
2010-03-03 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSDate.m: Fix last change to conform to coding standards.
|
||||
|
|
|
@ -439,7 +439,6 @@ replacementForClass(Class c)
|
|||
{
|
||||
if ([keys member: aKey] == nil)
|
||||
{
|
||||
GSMethodList m;
|
||||
NSMethodSignature *sig;
|
||||
SEL sel;
|
||||
IMP imp;
|
||||
|
@ -451,8 +450,6 @@ replacementForClass(Class c)
|
|||
NSString *tmp;
|
||||
unichar u;
|
||||
|
||||
m = GSAllocMethodList(2);
|
||||
|
||||
suffix = [aKey substringFromIndex: 1];
|
||||
u = uni_toupper([aKey characterAtIndex: 0]);
|
||||
tmp = [[NSString alloc] initWithCharacters: &u length: 1];
|
||||
|
@ -568,14 +565,19 @@ replacementForClass(Class c)
|
|||
|
||||
if (imp != 0)
|
||||
{
|
||||
GSAppendMethodToList(m, sel, [sig methodType], imp, YES);
|
||||
found = YES;
|
||||
if (class_addMethod(replacement, sel, imp, [sig methodType]))
|
||||
{
|
||||
found = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Failed to add setter method for %s to %@",
|
||||
sel_getName(sel), class_getName(original));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == YES)
|
||||
{
|
||||
GSAddMethodList(replacement, m, YES);
|
||||
GSFlushMethodCacheForClass(replacement);
|
||||
[keys addObject: aKey];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue