mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_each_line): check string's length when compare
separator and string. [ruby-core:35815] fixes #4586 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2cc02aeb50
commit
88014987ad
2 changed files with 7 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Apr 20 14:41:28 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (rb_str_each_line): check string's length when compare
|
||||||
|
separator and string. [ruby-core:35815] fixes #4586
|
||||||
|
|
||||||
Wed Apr 20 00:02:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Apr 20 00:02:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* misc/ruby-mode.el (ruby-parse-partial): use position of open paren.
|
* misc/ruby-mode.el (ruby-parse-partial): use position of open paren.
|
||||||
|
|
3
string.c
3
string.c
|
@ -6051,7 +6051,8 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str)
|
||||||
p -= n;
|
p -= n;
|
||||||
}
|
}
|
||||||
if (c == newline &&
|
if (c == newline &&
|
||||||
(rslen <= 1 || memcmp(RSTRING_PTR(rs), p, rslen) == 0)) {
|
(rslen <= 1 ||
|
||||||
|
(pend - p >= rslen && memcmp(RSTRING_PTR(rs), p, rslen) == 0))) {
|
||||||
line = rb_str_new5(str, s, p - s + (rslen ? rslen : n));
|
line = rb_str_new5(str, s, p - s + (rslen ? rslen : n));
|
||||||
OBJ_INFECT(line, str);
|
OBJ_INFECT(line, str);
|
||||||
rb_enc_cr_str_copy_for_substr(line, str);
|
rb_enc_cr_str_copy_for_substr(line, str);
|
||||||
|
|
Loading…
Add table
Reference in a new issue