From 2f3f0de99489f3ac7d958b8b1bf3115650a560bf Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 14 Jan 2009 03:35:25 +0000 Subject: * io.c (rb_io_s_pipe): reduced nest of rb_ensure of main block. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 1a445df2e..733d978c0 100644 --- a/io.c +++ b/io.c @@ -7028,9 +7028,10 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt) } static VALUE -pipe_yield(VALUE rw) +pipe_pair_close(VALUE rw) { - return rb_ensure(rb_yield, rw, io_close, rb_ary_entry(rw, 1)); + VALUE *rwp = (VALUE *)rw; + return rb_ensure(io_close, rwp[0], io_close, rwp[1]); } /* @@ -7135,7 +7136,10 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass) ret = rb_assoc_new(r, w); if (rb_block_given_p()) { - return rb_ensure(pipe_yield, ret, io_close, r); + VALUE rw[2]; + rw[0] = r; + rw[1] = w; + return rb_ensure(rb_yield, ret, pipe_pair_close, (VALUE)rw); } return ret; } -- cgit