Revision
3733
Author
lsansonetti@apple.com
Date
2010-03-10 20:13:56 -0800 (Wed, 10 Mar 2010)

Log Message

fixed a few bugs

Modified Paths

Diff

Modified: MacRuby/branches/icu/string.c (3732 => 3733)


--- MacRuby/branches/icu/string.c	2010-03-10 22:09:16 UTC (rev 3732)
+++ MacRuby/branches/icu/string.c	2010-03-11 04:13:56 UTC (rev 3733)
@@ -2647,6 +2647,7 @@
 	}
 
 	if (block_given) {
+	    rb_match_busy(match);
 	    rb_yield(scan_result);
 	    rb_backref_set(match);
 	    RETURN_IF_BROKEN();
@@ -3294,7 +3295,8 @@
 
 	if (block_given || !NIL_P(hash)) {
             if (block_given) {
-                repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
+		rb_match_busy(match);
+		repl = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
             }
             else {
                 repl = rb_hash_aref(hash, rstr_substr(str, results[0].beg,
@@ -3304,6 +3306,7 @@
 	    rstr_frozen_check(str);
 	    if (block_given) {
 		rb_backref_set(match);
+		RETURN_IF_BROKEN();
 	    }
 	}
 	else {
@@ -3429,7 +3432,8 @@
 	VALUE val;
 	if (block_given || !NIL_P(hash)) {
             if (block_given) {
-                val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
+		rb_match_busy(match);
+		val = rb_obj_as_string(rb_yield(rb_reg_nth_match(0, match)));
             }
             else {
                 val = rb_hash_aref(hash, rstr_substr(str, results[0].beg,
@@ -3439,6 +3443,7 @@
 	    rstr_frozen_check(str);
 	    if (block_given) {
 		rb_backref_set(match);
+		RETURN_IF_BROKEN();
 	    }
 	}
 	else {
@@ -3460,6 +3465,8 @@
 	if (results[0].beg == offset) {
 	    offset++;
 	}
+
+	rb_backref_set(match);
     }
 
     if (bang) {