[macruby-changes] [3650] MacRuby/branches/icu/string.c
source_changes at macosforge.org
source_changes at macosforge.org
Sat Feb 27 02:10:46 PST 2010
Revision: 3650
http://trac.macosforge.org/projects/ruby/changeset/3650
Author: lsansonetti at apple.com
Date: 2010-02-27 02:10:46 -0800 (Sat, 27 Feb 2010)
Log Message:
-----------
#split: never push nil strings
Modified Paths:
--------------
MacRuby/branches/icu/string.c
Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c 2010-02-27 10:10:08 UTC (rev 3649)
+++ MacRuby/branches/icu/string.c 2010-02-27 10:10:46 UTC (rev 3650)
@@ -2441,7 +2441,9 @@
if (beg == pos && results[0].beg == results[0].end) {
if (last_null) {
- rb_ary_push(result, rstr_substr(str, beg, 1));
+ if (beg + 1 <= len) {
+ rb_ary_push(result, rstr_substr(str, beg, 1));
+ }
beg = start;
}
else {
@@ -2457,7 +2459,10 @@
last_null = false;
for (int i = 1; i < count; i++) {
- rb_ary_push(result, rb_reg_nth_match(i, match));
+ VALUE match_str = rb_reg_nth_match(i, match);
+ if (match_str != Qnil) {
+ rb_ary_push(result, rb_reg_nth_match(i, match));
+ }
}
}
while (limit == Qnil || --lim > 1);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100227/69e043aa/attachment-0001.html>
More information about the macruby-changes
mailing list