ruby-changes:62054
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 29 Jun 2020 11:08:27 +0900 (JST)
Subject: [ruby-changes:62054] 08202d1f0e (master): check_exec_redirect: do not goto into a branch
https://git.ruby-lang.org/ruby.git/commit/?id=08202d1f0e From 08202d1f0e120bc09431149e3fe2284f992dbb6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 16 Jun 2020 12:53:24 +0900 Subject: check_exec_redirect: do not goto into a branch I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. diff --git a/process.c b/process.c index 054c303..a0b8467 100644 --- a/process.c +++ b/process.c @@ -1934,7 +1934,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp) https://github.com/ruby/ruby/blob/trunk/process.c#L1934 switch (TYPE(val)) { case T_SYMBOL: - if (!(id = rb_check_id(&val))) goto wrong_symbol; + id = rb_check_id(&val); if (id == id_close) { param = Qnil; eargp->fd_close = check_exec_redirect1(eargp->fd_close, key, param); @@ -1952,7 +1952,6 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp) https://github.com/ruby/ruby/blob/trunk/process.c#L1952 eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param); } else { - wrong_symbol: rb_raise(rb_eArgError, "wrong exec redirect symbol: %"PRIsVALUE, val); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/