Differences From Artifact [130a752ea7]:
- File src/OFObject.m — part of check-in [fcade8da38] at 2012-10-21 22:12:57 on branch trunk — Make GCC 4.4 happy. (user: js, size: 25155) [annotate] [blame] [check-ins using]
To Artifact [4b4eff1419]:
- File
src/OFObject.m
— part of check-in
[d3a2e59414]
at
2012-11-14 15:39:10
on branch trunk
— Initial -[forwarindTargetForSelector:].
This only works with the ObjFW runtime so far. The Apple runtime will
require an assembly implementation for every architecture. (user: js, size: 25411) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
122 123 124 125 126 127 128 129 | class_getName(object_getClass(obj))); abort(); } static IMP forward_handler(id obj, SEL sel) { if (class_isMetaClass(object_getClass(obj))) { | > > > | < < | < < | | | | | | | > > > | < < | < < | | | | | | | > > > > > > > | > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | class_getName(object_getClass(obj))); abort(); } static IMP forward_handler(id obj, SEL sel) { id target; /* Try resolveClassMethod:/resolveInstanceMethod: */ if (class_isMetaClass(object_getClass(obj))) { if ([obj respondsToSelector: @selector(resolveClassMethod:)] && [obj resolveClassMethod: sel]) { if (![obj respondsToSelector: sel]) { fprintf(stderr, "Runtime error: [%s " "resolveClassMethod: %s] returned YES " "without adding the method!\n", class_getName(obj), sel_getName(sel)); abort(); } return objc_msg_lookup(obj, sel); } } else { Class c = object_getClass(obj); if ([c respondsToSelector: @selector(resolveInstanceMethod:)] && [c resolveInstanceMethod: sel]) { if (![obj respondsToSelector: sel]) { fprintf(stderr, "Runtime error: [%s " "resolveInstanceMethod: %s] returned YES " "without adding the method!\n", class_getName(object_getClass(obj)), sel_getName(sel)); abort(); } return objc_msg_lookup(obj, sel); } } /* Try forwardingTargetForSelector: */ target = [obj forwardingTargetForSelector: sel]; if (target != obj && target != nil) return objc_msg_lookup(target, sel); return method_not_found_handler; } #endif #ifndef HAVE_OBJC_ENUMERATIONMUTATION void objc_enumerationMutation(id object) { |
︙ | ︙ | |||
949 950 951 952 953 954 955 956 957 958 959 960 961 962 | PRE_IVAR->lastMem = PRE_MEM(pointer)->prev; /* To detect double-free */ PRE_MEM(pointer)->owner = nil; free(PRE_MEM(pointer)); } - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVAR->retainCount); #elif defined(OF_THREADS) OF_ENSURE(of_spinlock_lock(&PRE_IVAR->retainCountSpinlock)); | > > > > > | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | PRE_IVAR->lastMem = PRE_MEM(pointer)->prev; /* To detect double-free */ PRE_MEM(pointer)->owner = nil; free(PRE_MEM(pointer)); } - (id)forwardingTargetForSelector: (SEL)selector { return nil; } - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVAR->retainCount); #elif defined(OF_THREADS) OF_ENSURE(of_spinlock_lock(&PRE_IVAR->retainCountSpinlock)); |
︙ | ︙ |