* eval.c (splat_value): split splat_value() and avalue_splat().

* io.c: there's no way to set non-IO value to current_file, thus
  no need for argf_forward().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-04-25 09:20:51 +00:00
parent d47be39735
commit a268f439f2
3 changed files with 11 additions and 46 deletions

View File

@ -1,3 +1,10 @@
Fri Apr 25 18:19:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (splat_value): split splat_value() and avalue_splat().
* io.c: there's no way to set non-IO value to current_file, thus
no need for argf_forward().
Fri Apr 25 02:03:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Apr 25 02:03:25 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): Proc#yield should pass through retry and * eval.c (proc_invoke): Proc#yield should pass through retry and

4
eval.c
View File

@ -2299,7 +2299,7 @@ splat_value(v)
} }
} }
#endif #endif
return avalue_splat(rb_Array(v)); return rb_Array(v);
} }
static VALUE static VALUE
@ -2686,7 +2686,7 @@ rb_eval(self, n)
break; break;
case NODE_SPLAT: case NODE_SPLAT:
result = splat_value(rb_eval(self, node->nd_head)); result = avalue_splat(splat_value(rb_eval(self, node->nd_head)));
break; break;
case NODE_SVALUE: case NODE_SVALUE:

42
io.c
View File

@ -2912,13 +2912,6 @@ rb_io_s_for_fd(argc, argv, klass)
static int binmode = 0; static int binmode = 0;
static VALUE
argf_forward()
{
return rb_funcall3(current_file, ruby_frame->last_func,
ruby_frame->argc, ruby_frame->argv);
}
static int static int
next_argv() next_argv()
{ {
@ -3659,10 +3652,6 @@ argf_tell()
if (!next_argv()) { if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to tell"); rb_raise(rb_eArgError, "no stream to tell");
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_tell(current_file); return rb_io_tell(current_file);
} }
@ -3675,10 +3664,6 @@ argf_seek_m(argc, argv, self)
if (!next_argv()) { if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to seek"); rb_raise(rb_eArgError, "no stream to seek");
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_seek_m(argc, argv, current_file); return rb_io_seek_m(argc, argv, current_file);
} }
@ -3689,10 +3674,6 @@ argf_set_pos(self, offset)
if (!next_argv()) { if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to set position"); rb_raise(rb_eArgError, "no stream to set position");
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_set_pos(current_file, offset); return rb_io_set_pos(current_file, offset);
} }
@ -3702,9 +3683,6 @@ argf_rewind()
if (!next_argv()) { if (!next_argv()) {
rb_raise(rb_eArgError, "no stream to rewind"); rb_raise(rb_eArgError, "no stream to rewind");
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_rewind(current_file); return rb_io_rewind(current_file);
} }
@ -3714,9 +3692,6 @@ argf_fileno()
if (!next_argv()) { if (!next_argv()) {
rb_raise(rb_eArgError, "no stream"); rb_raise(rb_eArgError, "no stream");
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_fileno(current_file); return rb_io_fileno(current_file);
} }
@ -3740,13 +3715,7 @@ argf_read(argc, argv)
retry: retry:
if (!next_argv()) return str; if (!next_argv()) return str;
if (TYPE(current_file) != T_FILE) {
tmp = argf_forward();
StringValue(tmp);
}
else {
tmp = io_read(argc, argv, current_file); tmp = io_read(argc, argv, current_file);
}
if (NIL_P(tmp) && next_p != -1) { if (NIL_P(tmp) && next_p != -1) {
io_close(current_file); io_close(current_file);
next_p = 1; next_p = 1;
@ -3807,9 +3776,6 @@ argf_eof()
if (next_p == 1) { if (next_p == 1) {
return Qtrue; return Qtrue;
} }
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
if (rb_io_eof(current_file)) { if (rb_io_eof(current_file)) {
next_p = 1; next_p = 1;
return Qtrue; return Qtrue;
@ -3860,12 +3826,7 @@ argf_binmode()
{ {
binmode = 1; binmode = 1;
next_argv(); next_argv();
if (TYPE(current_file) != T_FILE) {
argf_forward();
}
else {
rb_io_binmode(current_file); rb_io_binmode(current_file);
}
return argf; return argf;
} }
@ -3893,9 +3854,6 @@ argf_close()
static VALUE static VALUE
argf_closed() argf_closed()
{ {
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
return rb_io_closed(current_file); return rb_io_closed(current_file);
} }