From a268f439f21477489a1072e23ed564a6bb0bd4ae Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 25 Apr 2003 09:20:51 +0000 Subject: * 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 --- ChangeLog | 7 +++++++ eval.c | 4 ++-- io.c | 46 ++-------------------------------------------- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index af518c6d95..3adead9f3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Apr 25 18:19:03 2003 Yukihiro Matsumoto + + * 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 * eval.c (proc_invoke): Proc#yield should pass through retry and diff --git a/eval.c b/eval.c index 9ce0f1c49f..9240f3850e 100644 --- a/eval.c +++ b/eval.c @@ -2299,7 +2299,7 @@ splat_value(v) } } #endif - return avalue_splat(rb_Array(v)); + return rb_Array(v); } static VALUE @@ -2686,7 +2686,7 @@ rb_eval(self, n) break; case NODE_SPLAT: - result = splat_value(rb_eval(self, node->nd_head)); + result = avalue_splat(splat_value(rb_eval(self, node->nd_head))); break; case NODE_SVALUE: diff --git a/io.c b/io.c index 55fcfa4831..b7c525b1ff 100644 --- a/io.c +++ b/io.c @@ -2912,13 +2912,6 @@ rb_io_s_for_fd(argc, argv, klass) 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 next_argv() { @@ -3659,10 +3652,6 @@ argf_tell() if (!next_argv()) { rb_raise(rb_eArgError, "no stream to tell"); } - - if (TYPE(current_file) != T_FILE) { - return argf_forward(); - } return rb_io_tell(current_file); } @@ -3675,10 +3664,6 @@ argf_seek_m(argc, argv, self) if (!next_argv()) { 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); } @@ -3689,10 +3674,6 @@ argf_set_pos(self, offset) if (!next_argv()) { 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); } @@ -3702,9 +3683,6 @@ argf_rewind() if (!next_argv()) { rb_raise(rb_eArgError, "no stream to rewind"); } - if (TYPE(current_file) != T_FILE) { - return argf_forward(); - } return rb_io_rewind(current_file); } @@ -3714,9 +3692,6 @@ argf_fileno() if (!next_argv()) { rb_raise(rb_eArgError, "no stream"); } - if (TYPE(current_file) != T_FILE) { - return argf_forward(); - } return rb_io_fileno(current_file); } @@ -3740,13 +3715,7 @@ argf_read(argc, argv) retry: 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) { io_close(current_file); next_p = 1; @@ -3807,9 +3776,6 @@ argf_eof() if (next_p == 1) { return Qtrue; } - if (TYPE(current_file) != T_FILE) { - return argf_forward(); - } if (rb_io_eof(current_file)) { next_p = 1; return Qtrue; @@ -3860,12 +3826,7 @@ argf_binmode() { binmode = 1; next_argv(); - if (TYPE(current_file) != T_FILE) { - argf_forward(); - } - else { - rb_io_binmode(current_file); - } + rb_io_binmode(current_file); return argf; } @@ -3893,9 +3854,6 @@ argf_close() static VALUE argf_closed() { - if (TYPE(current_file) != T_FILE) { - return argf_forward(); - } return rb_io_closed(current_file); } -- cgit v1.2.3