[macruby-changes] [3961] MacRuby/trunk/bs.c

source_changes at macosforge.org source_changes at macosforge.org
Sat Apr 24 13:12:58 PDT 2010


Revision: 3961
          http://trac.macosforge.org/projects/ruby/changeset/3961
Author:   lsansonetti at 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:
--------------
    MacRuby/trunk/bs.c

Modified: MacRuby/trunk/bs.c
===================================================================
--- 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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100424/784b93f8/attachment.html>


More information about the macruby-changes mailing list