summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-09 15:10:03 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-09 15:10:03 +0000
commit6eb77404724eaca3c58c45d76cd5ab36fea2be4a (patch)
tree23aa3ed4c37b4e29fce3e59d35a3b0289b74ffbf /ext/stringio
parent4e817b39b42fb1089ed0d4eb5f8c4d3e0e695960 (diff)
* ext/stringio/stringio.c (strio_each, strio_readlines):
Use `NUM2LONG` instead of `FIX2INT`. Fixes [ruby-dev:43395]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r--ext/stringio/stringio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 1bb5e0f..9b446ae 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -1069,8 +1069,8 @@ strio_each(int argc, VALUE *argv, VALUE self)
RETURN_ENUMERATOR(self, argc, argv);
- if(argc > 0 && TYPE(argv[argc-1]) == T_FIXNUM &&
- FIX2INT(argv[argc-1]) == 0) {
+ if(argc > 0 && !NIL_P(argv[argc-1]) && NIL_P(rb_check_string_type(argv[argc-1])) &&
+ NUM2LONG(argv[argc-1]) == 0) {
rb_raise(rb_eArgError, "invalid limit: 0 for each_line");
}
@@ -1094,8 +1094,8 @@ strio_readlines(int argc, VALUE *argv, VALUE self)
struct StringIO *ptr = StringIO(self);
VALUE ary = rb_ary_new(), line;
- if(argc > 0 && TYPE(argv[argc-1]) == T_FIXNUM &&
- FIX2INT(argv[argc-1]) == 0) {
+ if(argc > 0 && !NIL_P(argv[argc-1]) && NIL_P(rb_check_string_type(argv[argc-1])) &&
+ NUM2LONG(argv[argc-1]) == 0) {
rb_raise(rb_eArgError, "invalid limit: 0 for readlines");
}