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
Родитель 2bfac015d3
Коммит 9298631316
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -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