aboutsummaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-06-16 12:53:24 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-06-29 11:05:41 +0900
commit08202d1f0e120bc09431149e3fe2284f992dbb6d (patch)
tree6518e1c6b1af4f9024c31ad680c9fb31802ed8d1 /process.c
parent92986313161c36157187ed7078fc4909bbf9bc04 (diff)
downloadruby-08202d1f0e120bc09431149e3fe2284f992dbb6d.tar.gz
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.
Diffstat (limited to 'process.c')
-rw-r--r--process.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/process.c b/process.c
index 054c303679..a0b8467879 100644
--- a/process.c
+++ b/process.c
@@ -1934,7 +1934,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
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)
eargp->fd_dup2 = check_exec_redirect1(eargp->fd_dup2, key, param);
}
else {
- wrong_symbol:
rb_raise(rb_eArgError, "wrong exec redirect symbol: %"PRIsVALUE,
val);
}