adium 2306:e9d017a24193: Colin points out the obvious. Use a cat...

commits at adium.im commits at adium.im
Sun May 24 08:29:00 UTC 2009


details:	http://hg.adium.im/adium/rev/e9d017a24193
revision:	2306:e9d017a24193
author:		David Smith <catfish.man at gmail.com>
date:		Sun May 24 01:28:49 2009 -0700

Colin points out the obvious. Use a category instead of swizzling here

diffstat:

 Source/AIObjectDebug.h |   8 ++++----
 Source/AIObjectDebug.m |  18 +++++-------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diffs (53 lines):

diff -r 6c5abb8a67a4 -r e9d017a24193 Source/AIObjectDebug.h
--- a/Source/AIObjectDebug.h	Sun May 24 01:26:25 2009 -0700
+++ b/Source/AIObjectDebug.h	Sun May 24 01:28:49 2009 -0700
@@ -5,9 +5,9 @@
 //  Created by David Smith on 5/24/2009
 //  Copyright 2009 The Adium Team. All rights reserved.
 //
+#ifdef DEBUG_BUILD
 
- at interface AIObjectDebug : NSObject {
-
-}
-
+ at interface NSObject (AIObjectDebug) 
+- (void) doesNotRecognizeSelector:(SEL)aSelector;
 @end
+#endif
\ No newline at end of file
diff -r 6c5abb8a67a4 -r e9d017a24193 Source/AIObjectDebug.m
--- a/Source/AIObjectDebug.m	Sun May 24 01:26:25 2009 -0700
+++ b/Source/AIObjectDebug.m	Sun May 24 01:28:49 2009 -0700
@@ -30,20 +30,12 @@
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-#import "AIObjectDebug.h"
-
-#ifdef DEBUG_BUILD
-#import <objc/objc-class.h>
-#endif
-
- at implementation AIObjectDebug
-
 #ifdef DEBUG_BUILD
 
-+ (void)load
-{
-	method_exchangeImplementations(class_getInstanceMethod(self, @selector(doesNotRecognizeSelector:)), class_getInstanceMethod([NSObject class], @selector(doesNotRecognizeSelector:)));
-}
+#import "AIObjectDebug.h"
+#import <objc/objc-runtime.h>
+
+ at implementation NSObject (AIObjectDebug)
 
 - (void)doesNotRecognizeSelector:(SEL)aSelector
 {
@@ -56,5 +48,5 @@
 	*((int*)0xdeadbeef) = 42;
 }
 
+ at end
 #endif
- at end




More information about the commits mailing list