adium 5192:724e5a1bc7c8: In case anyone would ever have the craz...

commits at adium.im commits at adium.im
Tue Oct 23 23:12:38 UTC 2012


details:	http://hg.adium.im/adium/rev/724e5a1bc7c8
revision:	5192:724e5a1bc7c8
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Wed Oct 24 01:11:34 2012 +0200

In case anyone would ever have the crazy idea to build Adium for 10.8+, you can now without making any changes to the code.

diffs (127 lines):

diff -r 321f3e9bbffe -r 724e5a1bc7c8 Plugins/Purple Service/adiumPurpleEventloop.m
--- a/Plugins/Purple Service/adiumPurpleEventloop.m	Wed Oct 24 01:00:17 2012 +0200
+++ b/Plugins/Purple Service/adiumPurpleEventloop.m	Wed Oct 24 01:11:34 2012 +0200
@@ -31,6 +31,8 @@
 
 static guint				sourceId = 0;		//The next source key; continuously incrementing
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
+
 /*
  * glib, unfortunately, identifies all sources and timers via unsigned 32 bit tags. We would like to map them to dispatch_source_t objects.
  * So: we make a CFDictionary with all null callbacks (hash on the value of the integer, cast to a void*, and don't retain/release anything).
@@ -58,6 +60,30 @@
     CFDictionaryRemoveValue(sourceInfoDict(), (void *)tag);
 }
 
+#else
+
+static inline NSMutableDictionary *sourceInfoDict() {
+    static NSMutableDictionary * _sourceInfoDict;
+    static dispatch_once_t sourceInfoDictToken;
+	
+    dispatch_once(&sourceInfoDictToken, ^{
+		_sourceInfoDict = [[NSMutableDictionary alloc] init];
+	});
+	
+    return _sourceInfoDict;
+}
+
+static inline dispatch_source_t sourceForTag(guint tag) {
+    return [sourceInfoDict() objectForKey:@(tag)];
+}
+static inline void setSourceForTag(dispatch_source_t source, guint tag) {
+	[sourceInfoDict() setObject:source forKey:@(tag)];
+}
+static inline void removeSourceForTag(guint tag) {
+	[sourceInfoDict() removeObjectForKey:@(tag)];
+}
+#endif
+
 gboolean adium_source_remove(guint tag) {
 	dispatch_source_t src = sourceForTag(tag);
     
@@ -72,7 +98,9 @@
 	
     removeSourceForTag(tag);
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
 	dispatch_release(src);
+#endif
 	
 	return success;
 }
diff -r 321f3e9bbffe -r 724e5a1bc7c8 Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m	Wed Oct 24 01:00:17 2012 +0200
+++ b/Source/AILoggerPlugin.m	Wed Oct 24 01:11:34 2012 +0200
@@ -319,17 +319,30 @@
 	dispatch_group_wait(closingIndexGroup, DISPATCH_TIME_FOREVER);
 	dispatch_group_wait(logAppendingGroup, DISPATCH_TIME_FOREVER);
 	dispatch_group_wait(loggerPluginGroup, DISPATCH_TIME_FOREVER);
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
+	dispatch_release(dirtyLogSetMutationQueue);
+	dispatch_release(searchIndexQueue);
+	dispatch_release(activeAppendersMutationQueue);
+	dispatch_release(logIndexingGroup);
+	dispatch_release(closingIndexGroup);
+	dispatch_release(addToSearchKitQueue);
+	dispatch_release(logAppendingGroup);
+	dispatch_release(ioQueue);
+	dispatch_release(jobSemaphore);
+	dispatch_release(loggerPluginGroup);
+#endif
 	
-	dispatch_release(dirtyLogSetMutationQueue); dirtyLogSetMutationQueue = nil;
-	dispatch_release(searchIndexQueue); searchIndexQueue = nil;
-	dispatch_release(activeAppendersMutationQueue); activeAppendersMutationQueue = nil;
-	dispatch_release(logIndexingGroup); logIndexingGroup = nil;
-	dispatch_release(closingIndexGroup); closingIndexGroup = nil;
-	dispatch_release(addToSearchKitQueue); addToSearchKitQueue = nil;
-	dispatch_release(logAppendingGroup); logAppendingGroup = nil;
-	dispatch_release(ioQueue); ioQueue = nil;
-	dispatch_release(jobSemaphore); jobSemaphore = nil;
-	dispatch_release(loggerPluginGroup); loggerPluginGroup = nil;
+	dirtyLogSetMutationQueue = nil;
+	searchIndexQueue = nil;
+	activeAppendersMutationQueue = nil;
+	logIndexingGroup = nil;
+	closingIndexGroup = nil;
+	addToSearchKitQueue = nil;
+	logAppendingGroup = nil;
+	ioQueue = nil;
+	jobSemaphore = nil;
+	loggerPluginGroup = nil;
 }
 #pragma mark AILoggerPlugin Plubic Methods
 //Paths
diff -r 321f3e9bbffe -r 724e5a1bc7c8 Source/AdiumApplescriptRunner.m
--- a/Source/AdiumApplescriptRunner.m	Wed Oct 24 01:00:17 2012 +0200
+++ b/Source/AdiumApplescriptRunner.m	Wed Oct 24 01:11:34 2012 +0200
@@ -60,12 +60,15 @@
 		xpc_object_t argObject = xpc_string_create([argument UTF8String]);
 		
 		xpc_array_set_value(array, XPC_ARRAY_APPEND, argObject);
-		
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
 		xpc_release(argObject);
+#endif
 	}
 	
 	xpc_dictionary_set_value(obj, "arguments", array);
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
 	xpc_release(array);
+#endif
 	
 	xpc_connection_send_message_with_reply(applescriptRunner, obj, dispatch_get_main_queue(), ^(xpc_object_t reply){
 		if (target && selector) {
@@ -75,7 +78,9 @@
 		}
 	});
 	
+#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
 	xpc_release(obj);
+#endif
 }
 
 @end




More information about the commits mailing list