Overview
Comment: | Clean up method replacing. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fdcb2a71e4bc2790db7438d44f055db6 |
User & Date: | js on 2010-07-08 10:04:04 |
Other Links: | manifest | tags |
Context
2010-07-08
| ||
18:49 | Resolve attribute namespaces after all attributes have been parsed. check-in: 4c57833cfa user: js tags: trunk | |
10:04 | Clean up method replacing. check-in: fdcb2a71e4 user: js tags: trunk | |
09:44 | Cache OFAutoreleasePool class. check-in: 3c5eb0ddb6 user: js tags: trunk | |
Changes
Modified src/OFObject.m from [85afaae721] to [b60749cd23].
︙ | ︙ | |||
230 231 232 233 234 235 236 237 238 239 | #endif } + (IMP)setImplementation: (IMP)newimp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) return objc_replace_class_method(self, selector, newimp); #elif defined(OF_APPLE_RUNTIME) return class_replaceMethod(self->isa, selector, newimp, | > > > > > > > > > > > | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | #endif } + (IMP)setImplementation: (IMP)newimp forClassMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_class_method(self, selector, newimp); #elif defined(OF_APPLE_RUNTIME) Method method; if (newimp == (IMP)0 || (method = class_getClassMethod(self, selector)) == NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return class_replaceMethod(self->isa, selector, newimp, method_getTypeEncoding(method)); #else Method_t method; IMP oldimp; /* The class method is the instance method of the meta class */ if ((method = class_get_instance_method(self->class_pointer, selector)) == NULL) |
︙ | ︙ | |||
269 270 271 272 273 274 275 | { IMP newimp; if (![class isSubclassOfClass: self]) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; | < < < < | < < < < < > > > > > > > > > > > | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | { IMP newimp; if (![class isSubclassOfClass: self]) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; newimp = [class methodForSelector: selector]; return [self setImplementation: newimp forClassMethod: selector]; } + (IMP)setImplementation: (IMP)newimp forInstanceMethod: (SEL)selector { #if defined(OF_OBJFW_RUNTIME) if (newimp == (IMP)0 || !class_respondsToSelector(self, selector)) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return objc_replace_instance_method(self, selector, newimp); #elif defined(OF_APPLE_RUNTIME) Method method; if (newimp == (IMP)0 || (method = class_getInstanceMethod(self, selector)) == NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; return class_replaceMethod(self, selector, newimp, method_getTypeEncoding(method)); #else Method_t method = class_get_instance_method(self, selector); IMP oldimp; if (method == NULL) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; |
︙ | ︙ | |||
325 326 327 328 329 330 331 | { IMP newimp; if (![class isSubclassOfClass: self]) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; | < | < < < < < | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | { IMP newimp; if (![class isSubclassOfClass: self]) @throw [OFInvalidArgumentException newWithClass: self selector: _cmd]; newimp = [class instanceMethodForSelector: selector]; return [self setImplementation: newimp forInstanceMethod: selector]; } - init { |
︙ | ︙ |