[macruby-changes] [2965] MacRuby/trunk/string.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 5 23:01:47 PST 2009


Revision: 2965
          http://trac.macosforge.org/projects/ruby/changeset/2965
Author:   lsansonetti at apple.com
Date:     2009-11-05 23:01:44 -0800 (Thu, 05 Nov 2009)
Log Message:
-----------
faster -[Symbol isEqual:]

Modified Paths:
--------------
    MacRuby/trunk/string.c

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2009-11-06 02:12:48 UTC (rev 2964)
+++ MacRuby/trunk/string.c	2009-11-06 07:01:44 UTC (rev 2965)
@@ -5255,13 +5255,11 @@
 imp_rb_symbol_getCharactersRange(void *rcv, SEL sel, UniChar *buffer, 
 	CFRange range)
 {
-    int i;
-
     if (range.location + range.length > RSYMBOL(rcv)->len) {
 	rb_bug("[Symbol getCharacters:range:] out of bounds");
     }
 
-    for (i = range.location; i < range.location + range.length; i++) {
+    for (int i = range.location; i < range.location + range.length; i++) {
 	*buffer = RSYMBOL(rcv)->str[i];
 	buffer++;
     }
@@ -5276,7 +5274,10 @@
     if (other == NULL || *(VALUE *)other != rb_cSymbol) {
 	return false;
     }
-    return CFStringCompare((CFStringRef)rcv, (CFStringRef)other, 0) == 0;
+    if (RSYMBOL(rcv)->len != RSYMBOL(other)->len) {
+	return false;
+    }
+    return strcmp(RSYMBOL(rcv)->str, RSYMBOL(other)->str) == 0;
 }
 
 static void *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091105/36438830/attachment.html>


More information about the macruby-changes mailing list