[darwinbuild-changes] [251] trunk/darwinxref/cfutils.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 4 02:01:59 PDT 2006
Revision: 251
http://trac.macosforge.org/projects/darwinbuild/changeset/251
Author: kevin
Date: 2006-10-04 02:01:59 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
- moved arrayAppendArrayDistinct to here
- properly quote dictionary keys in writePlist()
Modified Paths:
--------------
trunk/darwinxref/cfutils.c
Modified: trunk/darwinxref/cfutils.c
===================================================================
--- trunk/darwinxref/cfutils.c 2005-09-16 02:50:13 UTC (rev 250)
+++ trunk/darwinxref/cfutils.c 2006-10-04 09:01:59 UTC (rev 251)
@@ -196,9 +196,9 @@
int count = CFArrayGetCount(keys);
for (i = 0; i < count; ++i) {
CFStringRef key = CFArrayGetValueAtIndex(keys, i);
- char* utf8 = strdup_cfstr(key);
- result += fprintf(f, "%s\t%s = ", t, utf8);
- free(utf8);
+ result += fprintf(f, "\t%s", t);
+ result += writePlist(f, key, tabs+1);
+ result += fprintf(f, " = ");
result += writePlist(f, CFDictionaryGetValue(p,key), tabs+1);
result += fprintf(f, ";\n");
}
@@ -254,6 +254,18 @@
return res;
}
+// appends each element that does not already exist in the array
+void arrayAppendArrayDistinct(CFMutableArrayRef array, CFArrayRef other) {
+ CFIndex i, count = CFArrayGetCount(other);
+ CFRange range = CFRangeMake(0, CFArrayGetCount(array));
+ for (i = 0; i < count; ++i) {
+ CFTypeRef o = CFArrayGetValueAtIndex(other, i);
+ if (!CFArrayContainsValue(array, range, o)) {
+ CFArrayAppendValue(array, o);
+ }
+ }
+}
+
//
// Call backs suitable for adding C strings to a CFArray
//
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/a1d054fa/attachment-0001.html
More information about the darwinbuild-changes
mailing list