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

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 6 16:05:30 PDT 2010


Revision: 4585
          http://trac.macosforge.org/projects/ruby/changeset/4585
Author:   watson1978 at gmail.com
Date:     2010-10-06 16:05:28 -0700 (Wed, 06 Oct 2010)
Log Message:
-----------
Fixed a bug of String#split(sep, limit), when passed value to limit.

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

Modified: MacRuby/trunk/string.c
===================================================================
--- MacRuby/trunk/string.c	2010-10-06 21:54:51 UTC (rev 4584)
+++ MacRuby/trunk/string.c	2010-10-06 23:05:28 UTC (rev 4585)
@@ -3167,10 +3167,11 @@
 		    rb_ary_push(result, substr); 
 		}
 		beg = i + 1;
+
+		if (limit != Qnil && --lim <= 1) {
+		    break;
+		}
 	    }
-	    if (limit != Qnil && --lim <= 0) {
-		break;
-	    }
 	}
 
 	if (need_free) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101006/c00981fa/attachment.html>


More information about the macruby-changes mailing list