Revision: 4260
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4260&view=rev
Author:   hofman
Date:     2008-07-20 20:03:24 +0000 (Sun, 20 Jul 2008)

Log Message:
-----------
Don't return anything when registering a new method. Simplify implementation 
for runtime when compiling for 10.5-only.

Modified Paths:
--------------
    trunk/SKUtilities.h
    trunk/SKUtilities.m

Modified: trunk/SKUtilities.h
===================================================================
--- trunk/SKUtilities.h 2008-07-20 19:42:44 UTC (rev 4259)
+++ trunk/SKUtilities.h 2008-07-20 20:03:24 UTC (rev 4260)
@@ -21,8 +21,8 @@
 IMP SKReplaceMethodImplementationWithSelector(Class aClass, SEL aSelector, SEL 
impSelector);
 IMP SKReplaceClassMethodImplementationWithSelector(Class aClass, SEL 
aSelector, SEL impSelector);
 void SKRegisterMethodImplementation(Class aClass, SEL aSelector, IMP anImp, 
const char *types, BOOL isInstance);
-IMP SKRegisterMethodImplementationWithSelector(Class aClass, SEL aSelector, 
SEL impSelector);
-IMP SKRegisterClassMethodImplementationWithSelector(Class aClass, SEL 
aSelector, SEL impSelector);
+void SKRegisterMethodImplementationWithSelector(Class aClass, SEL aSelector, 
SEL impSelector);
+void SKRegisterClassMethodImplementationWithSelector(Class aClass, SEL 
aSelector, SEL impSelector);
 
 #define OBINITIALIZE \
     do { \

Modified: trunk/SKUtilities.m
===================================================================
--- trunk/SKUtilities.m 2008-07-20 19:42:44 UTC (rev 4259)
+++ trunk/SKUtilities.m 2008-07-20 20:03:24 UTC (rev 4260)
@@ -19,6 +19,8 @@
 
 // wrappers around 10.5 only functions, use 10.4 API when the function is not 
defined
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
+
 static Class SK_object_getClass(id object)
 {
     return object_getClass != NULL ? object_getClass(object) : object->isa;
@@ -68,6 +70,40 @@
     }
 }
 
+#else
+
+static Class SK_object_getClass(id object)
+{
+    return object_getClass(object);
+}
+
+static IMP SK_method_getImplementation(Method aMethod)
+{
+    return method_getImplementation(aMethod);
+} 
+
+static IMP SK_method_setImplementation(Method aMethod, IMP anImp)
+{
+    return method_setImplementation(aMethod, anImp);
+} 
+
+static const char *SK_method_getTypeEncoding(Method aMethod)
+{
+    return method_getTypeEncoding(aMethod);
+}
+
+static Class SK_class_getSuperclass(Class aClass)
+{
+    return class_getSuperclass(aClass);
+}
+
+static void SK_class_addMethod(Class aClass, SEL selector, IMP methodImp, 
const char *methodTypes)
+{
+    class_addMethod(aClass, selector, methodImp, methodTypes);
+}
+
+#endif
+
 static Method SK_class_getMethod(Class aClass, SEL aSelector, BOOL isInstance)
 {
     return isInstance ? class_getInstanceMethod(aClass, aSelector) : 
class_getClassMethod(aClass, aSelector);
@@ -125,28 +161,16 @@
         _objc_flush_caches(realClass);
 }
 
-IMP SKRegisterMethodImplementationWithSelector(Class aClass, SEL aSelector, 
SEL impSelector)
+void SKRegisterMethodImplementationWithSelector(Class aClass, SEL aSelector, 
SEL impSelector)
 {
-    IMP imp = NULL;
     Method method = class_getInstanceMethod(aClass, impSelector);
-    
-    if (method) {
-        imp = SK_method_getImplementation(method);
-        SKRegisterMethodImplementation(aClass, aSelector, imp, 
SK_method_getTypeEncoding(method), YES);
-    }
-    
-    return imp;
+    if (method)
+        SKRegisterMethodImplementation(aClass, aSelector, 
SK_method_getImplementation(method), SK_method_getTypeEncoding(method), YES);
 }
 
-IMP SKRegisterClassMethodImplementationWithSelector(Class aClass, SEL 
aSelector, SEL impSelector)
+void SKRegisterClassMethodImplementationWithSelector(Class aClass, SEL 
aSelector, SEL impSelector)
 {
-    IMP imp = NULL;
     Method method = class_getClassMethod(aClass, impSelector);
-    
-    if (method) {
-        imp = SK_method_getImplementation(method);
-        SKRegisterMethodImplementation(aClass, aSelector, imp, 
SK_method_getTypeEncoding(method), NO);
-    }
-    
-    return imp;
+    if (method)
+        SKRegisterMethodImplementation(aClass, aSelector, 
SK_method_getImplementation(method), SK_method_getTypeEncoding(method), NO);
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to