summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-21 01:25:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-21 01:25:55 +0000
commitc98b3a7e193a8a3a930938431c26a6fe1f709bd9 (patch)
treede373ecfb94521e8f87f7ffff0303de664c848b8 /io.c
parent1b16c560e4941fe1505a92d1cf1c8873134014bb (diff)
* io.c (prepare_getline_args): check if rs is a string when non-nil
lim is given. [ruby-dev:35610] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 9fa241f6c3..52216cff43 100644
--- a/io.c
+++ b/io.c
@@ -1892,7 +1892,10 @@ prepare_getline_args(int argc, VALUE *argv, VALUE *rsp, long *limit, VALUE io)
}
else {
rb_scan_args(argc, argv, "11", &rs, &lim);
- if (NIL_P(lim) && !NIL_P(rs) && TYPE(rs) != T_STRING) {
+ if (!NIL_P(lim)) {
+ StringValue(rs);
+ }
+ else if (!NIL_P(rs) && TYPE(rs) != T_STRING) {
VALUE tmp = rb_check_string_type(rs);
if (NIL_P(tmp)) {