rb_io_modestr_fmode: 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-15 15:26:31 +09:00
Родитель 0e4ee71546
Коммит 9e92292e30
1 изменённых файлов: 4 добавлений и 2 удалений

6
io.c
Просмотреть файл

@ -5541,8 +5541,7 @@ rb_io_modestr_fmode(const char *modestr)
fmode |= FMODE_WRITABLE | FMODE_APPEND | FMODE_CREATE;
break;
default:
error:
rb_raise(rb_eArgError, "invalid access mode %s", modestr);
goto error;
}
while (*m) {
@ -5576,6 +5575,9 @@ rb_io_modestr_fmode(const char *modestr)
goto error;
return fmode;
error:
rb_raise(rb_eArgError, "invalid access mode %s", modestr);
}
int