1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
parent 0e4ee71546
commit 9e92292e30
Notes: git 2020-06-29 11:07:02 +09:00

6
io.c
View file

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