static VALUE
strio_readlines(int argc, VALUE *argv, VALUE self)
{
VALUE ary, line;
StringIO(self);
ary = rb_ary_new();
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");
}
while (!NIL_P(line = strio_getline(argc, argv, readable(self)))) {
rb_ary_push(ary, line);
}
return ary;
}