From 4a0916e97bb38519567906531b1469a3f3819519 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 4 May 2008 03:59:01 +0000 Subject: [PATCH] * string.c (rb_str_each_line): return original string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ string.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a3430adf..cf88c30aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun May 4 12:57:58 2008 Tanaka Akira + + * string.c (rb_str_each_line): return original string. + Sat May 3 20:57:06 2008 Tanaka Akira * test/ruby/envutil.rb (Test::Unit::Assertions#assert_normal_exit): diff --git a/string.c b/string.c index f011fddc7..6eb213fa7 100644 --- a/string.c +++ b/string.c @@ -5045,6 +5045,7 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str) long len, rslen; VALUE line; int n; + VALUE orig = str; if (argc == 0) { rs = rb_rs; @@ -5055,7 +5056,7 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str) RETURN_ENUMERATOR(str, argc, argv); if (NIL_P(rs)) { rb_yield(str); - return str; + return orig; } str = rb_str_new4(str); ptr = p = s = RSTRING_PTR(str); @@ -5124,7 +5125,7 @@ rb_str_each_line(int argc, VALUE *argv, VALUE str) rb_yield(line); } - return str; + return orig; } -- 2.11.4.GIT