rb_io_each_codepoint: 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
1e8461424c
commit
0e4ee71546
Notes:
git
2020-06-29 11:07:03 +09:00
6
io.c
6
io.c
@ -4173,8 +4173,7 @@ rb_io_each_codepoint(VALUE io)
|
|||||||
rb_yield(UINT2NUM(c));
|
rb_yield(UINT2NUM(c));
|
||||||
}
|
}
|
||||||
else if (MBCLEN_INVALID_P(r)) {
|
else if (MBCLEN_INVALID_P(r)) {
|
||||||
invalid:
|
goto invalid;
|
||||||
rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc));
|
|
||||||
}
|
}
|
||||||
else if (MBCLEN_NEEDMORE_P(r)) {
|
else if (MBCLEN_NEEDMORE_P(r)) {
|
||||||
char cbuf[8], *p = cbuf;
|
char cbuf[8], *p = cbuf;
|
||||||
@ -4197,6 +4196,9 @@ rb_io_each_codepoint(VALUE io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return io;
|
return io;
|
||||||
|
|
||||||
|
invalid:
|
||||||
|
rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user