[darwinbuild-changes] [49] trunk/darwinxref/DBDataStore.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:41:43 PDT 2006


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

Log Message:
-----------
- return NULL instead of an empty array or dictionary.
- fixed inheritance bug where only build aliases were being resolved

Modified Paths:
--------------
    trunk/darwinxref/DBDataStore.c

Modified: trunk/darwinxref/DBDataStore.c
===================================================================
--- trunk/darwinxref/DBDataStore.c	2005-07-09 00:15:00 UTC (rev 48)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 08:41:43 UTC (rev 49)
@@ -266,7 +266,7 @@
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
 	char* sql;
-	if (project)
+	if (cproj && *cproj != 0)
 		sql = "SELECT value FROM properties WHERE property=%Q AND build=%Q AND project=%Q";
 	else
 		sql = "SELECT value FROM properties WHERE property=%Q AND build=%Q AND project IS NULL";
@@ -282,11 +282,15 @@
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
 	char* sql;
-	if (project)
+	if (cproj && *cproj != 0)
 		sql = "SELECT value FROM properties WHERE property=%Q AND build=%Q AND project=%Q ORDER BY key";
 	else
 		sql = "SELECT value FROM properties WHERE property=%Q AND build=%Q AND project IS NULL ORDER BY key";
 	CFArrayRef res = SQL_CFARRAY(sql, cprop, cbuild, cproj);
+	if (res && CFArrayGetCount(res) == 0) {
+		CFRelease(res);
+		res = NULL;
+	}
 	free(cproj);
 	free(cprop);
 	free(cbuild);
@@ -298,11 +302,15 @@
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
 	char* sql;
-	if (project)
+	if (cproj && *cproj != 0)
 		sql = "SELECT DISTINCT key,value FROM properties WHERE property=%Q AND build=%Q AND project=%Q ORDER BY key";
 	else
 		sql = "SELECT DISTINCT key,value FROM properties WHERE property=%Q AND build=%Q AND project IS NULL ORDER BY key";
 	CFDictionaryRef res = SQL_CFDICTIONARY(sql, cprop, cbuild, cproj);
+	if (res && CFDictionaryGetCount(res) == 0) {
+		CFRelease(res);
+		res = NULL;
+	}
 	free(cbuild);
 	free(cproj);
 	free(cprop);
@@ -337,11 +345,11 @@
 		build = inherits;
 	} while (build != NULL);
 
-	if (res == NULL && original != NULL) {
+	if (res == NULL) {
 		CFIndex i, count = CFArrayGetCount(builds);
 		for (i = 0; i < count; ++i) {
 			build = CFArrayGetValueAtIndex(builds, i);
-			res = func(build, original, property);
+			res = func(build, original ? original : project, property);
 			if (res) break;
 		}
 	}

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


More information about the darwinbuild-changes mailing list