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:
parent
0e4ee71546
commit
9e92292e30
Notes:
git
2020-06-29 11:07:02 +09:00
1 changed files with 4 additions and 2 deletions
6
io.c
6
io.c
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue