Revision
3961
Author
lsansonetti@apple.com
Date
2010-04-24 13:12:57 -0700 (Sat, 24 Apr 2010)

Log Message

when checking if a given path has already been loaded, do a case insensitive search

Modified Paths

Diff

Modified: MacRuby/trunk/bs.c (3960 => 3961)


--- MacRuby/trunk/bs.c	2010-04-23 20:42:56 UTC (rev 3960)
+++ MacRuby/trunk/bs.c	2010-04-24 20:12:57 UTC (rev 3961)
@@ -446,12 +446,17 @@
   if (callback == NULL)
     return false;
 
+  /* check if the given framework path has not been loaded already */
   cf_path = CFStringCreateWithFileSystemRepresentation(kCFAllocatorMalloc, 
     path);
-  if (CFArrayContainsValue(parser->loaded_paths, CFRangeMake(0, CFArrayGetCount(parser->loaded_paths)), cf_path)) {
-    /* already loaded */
-    CFRelease(cf_path);
-    return true;
+  for (unsigned i = 0, count = CFArrayGetCount(parser->loaded_paths);
+       i < count; i++) {
+    CFStringRef s = CFArrayGetValueAtIndex(parser->loaded_paths, i);
+    if (CFStringCompare(cf_path, s, kCFCompareCaseInsensitive)
+        == kCFCompareEqualTo) {
+      /* already loaded */
+      return true;
+    }
   }
 
   //printf("parsing %s\n", path);