[darwinbuild-changes] [4] trunk/darwinxref/plugins/dependencies.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:36:26 PDT 2006


Revision: 4
          http://trac.macosforge.org/projects/darwinbuild/changeset/4
Author:   kevin
Date:     2006-10-04 01:36:26 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- if there is only one dependency, the string needs to be coerced into an array

Modified Paths:
--------------
    trunk/darwinxref/plugins/dependencies.c

Modified: trunk/darwinxref/plugins/dependencies.c
===================================================================
--- trunk/darwinxref/plugins/dependencies.c	2005-06-03 20:57:04 UTC (rev 3)
+++ trunk/darwinxref/plugins/dependencies.c	2006-10-04 08:36:26 UTC (rev 4)
@@ -83,13 +83,20 @@
 
 void printDependencies(void* session, CFStringRef* types, CFStringRef* recursiveTypes, CFMutableSetRef visited, CFStringRef build, CFStringRef project) {
 	if (!visited) visited = CFSetCreateMutable(NULL, 0, &kCFTypeSetCallBacks);
-
+	
 	CFDictionaryRef dependencies = DBCopyPropDictionary(session, build, project, CFSTR("dependencies"));
 	if (dependencies) {
 		CFStringRef* type = types;
 		while (*type != NULL) {
 			CFArrayRef array = CFDictionaryGetValue(dependencies, *type);
 			if (array) {
+				// if it's a single string, make it an array
+				if (CFGetTypeID(array) == CFStringGetTypeID()) {
+					array = CFArrayCreate(NULL, (const void**)&array, 1, &kCFTypeArrayCallBacks);
+				} else {
+					CFRetain(array);
+				}
+
 				CFIndex i, count = CFArrayGetCount(array);
 				for (i = 0; i < count; ++i) {
 					CFStringRef newproject = CFArrayGetValueAtIndex(array, i);
@@ -99,6 +106,8 @@
 						printDependencies(session, recursiveTypes, recursiveTypes, visited, build, newproject);
 					}
 				}
+				
+				CFRelease(array);
 			}
 			++type;
 		}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/d9fdc368/attachment-0001.html


More information about the darwinbuild-changes mailing list