check_exec_redirect_fd: 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:27:33 +09:00
parent 2bfac015d3
commit 9298631316
Notes: git 2020-06-29 11:06:54 +09:00

View File

@ -1886,8 +1886,7 @@ check_exec_redirect_fd(VALUE v, int iskey)
fd = fptr->fd;
}
else {
wrong:
rb_raise(rb_eArgError, "wrong exec redirect");
goto wrong;
}
if (fd < 0) {
rb_raise(rb_eArgError, "negative file descriptor");
@ -1898,6 +1897,9 @@ check_exec_redirect_fd(VALUE v, int iskey)
}
#endif
return INT2FIX(fd);
wrong:
rb_raise(rb_eArgError, "wrong exec redirect");
}
static VALUE