Skip to content

Commit

Permalink
check_exec_redirect: do not goto into a branch
Browse files Browse the repository at this point in the history
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
  • Loading branch information
shyouhei committed Jun 29, 2020
1 parent 9298631 commit 08202d1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions process.c
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit 08202d1

Please sign in to comment.