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.
This commit is contained in:
卜部昌平 2020-06-16 12:53:24 +09:00
parent 9298631316
commit 08202d1f0e
Notes: git 2020-06-29 11:06:53 +09:00

View File

@ -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);
}