From 51194e8eb5db1667efce48ef06a37436ca7ea7de Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Fri, 15 Oct 2010 22:27:39 +0000 Subject: In libobjc/: 2010-10-15 Nicola Pero In libobjc/: 2010-10-15 Nicola Pero * objc-private/runtime.h (__objc_update_classes_with_methods): New. * class.c (__objc_update_classes_with_methods): New. (objc_getClassList): Do not lock the class lock. * methods.c (method_exchangeImplementations): New. (method_setImplementation): New. * objc/runtime.h (method_setImplementation): New. (method_exchangeImplementations): New. From-SVN: r165525 --- libobjc/objc/runtime.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'libobjc/objc') diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h index 9380331..bb241ac 100644 --- a/libobjc/objc/runtime.h +++ b/libobjc/objc/runtime.h @@ -545,7 +545,26 @@ objc_EXPORT void method_getReturnType (Method method, char *returnValue, objc_EXPORT void method_getArgumentType (Method method, unsigned int argumentNumber, char *returnValue, size_t returnValueSize); - +/* Change the implementation of the method. It also searches all + classes for any class implementing the method, and replaces the + existing implementation with the new one. For that to work, + 'method' must be a method returned by class_getInstanceMethod() or + class_getClassMethod() as the matching is done by comparing the + pointers; in that case, only the implementation in the class is + modified. Return the previous implementation that has been + replaced. If method or implementation is NULL, do nothing and + return NULL. */ +objc_EXPORT IMP +method_setImplementation (Method method, IMP implementation); + +/* Swap the implementation of two methods in a single, atomic + operation. This is equivalent to getting the implementation of + each method and then calling method_setImplementation() on the + other one. For this to work, the two methods must have been + returned by class_getInstanceMethod() or class_getClassMethod(). + If 'method_a' or 'method_b' is NULL, do nothing. */ +objc_EXPORT void +method_exchangeImplementations (Method method_a, Method method_b); /** Implementation: the following functions are in protocols.c. */ -- cgit v1.1