diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-15 15:26:31 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-29 11:05:41 +0900 |
commit | 9e92292e307fcdb3ef8e44f942135116de6616cf (patch) | |
tree | 16d8efcfa25a3cb69487e17da9bebd642d64cf0d | |
parent | 0e4ee71546665744a3c658bc708738b4e01d39ce (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3247
-rw-r--r-- | io.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |