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

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 22 23:12:09 PST 2010


Revision: 5074
          http://trac.macosforge.org/projects/ruby/changeset/5074
Author:   vincent.isambart at gmail.com
Date:     2010-12-22 23:12:05 -0800 (Wed, 22 Dec 2010)
Log Message:
-----------
fixed a bug in String#search_codepoint (it was ignoring breaks)

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

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-12-23 00:52:11 UTC (rev 5073)
+++ MacRuby/trunk/string.c	2010-12-23 07:12:05 UTC (rev 5074)
@@ -4495,7 +4495,7 @@
 	VALUE charstr = (VALUE)str_new_copy_of_part(RSTR(str),
 	    start_index, char_len);
 	rb_yield(charstr);
-	VALUE v = rb_vm_pop_broken_value(); \
+	VALUE v = rb_vm_pop_broken_value();
 	if (v != Qundef) {
 	    return_value = v;
 	    *stop = true;
@@ -4557,17 +4557,21 @@
 {
     RETURN_ENUMERATOR(str, 0, 0);
 
+    __block VALUE return_value = str;
     str_each_uchar32(RSTR(str), ^(UChar32 c, long start_index, long char_len, bool *stop) {
 	if (c == U_SENTINEL) {
 	    rb_raise(rb_eArgError, "invalid byte sequence in %s",
 		RSTR(str)->encoding->public_name);
 	}
-	else {
-	    rb_yield(INT2NUM(c));
+	rb_yield(INT2NUM(c));
+	VALUE v = rb_vm_pop_broken_value();
+	if (v != Qundef) {
+	    return_value = v;
+	    *stop = true;
 	}
     });
 
-    return str;
+    return return_value;
 }
 
 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101222/e7057844/attachment.html>


More information about the macruby-changes mailing list