mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Let the index boundary check in rb_enc_from_index be flagged as unlikely
[Misc #15806] Closes: https://github.com/ruby/ruby/pull/2128
This commit is contained in:
parent
6546aed475
commit
009ec37a47
1 changed files with 1 additions and 1 deletions
|
@ -608,7 +608,7 @@ rb_enc_init(void)
|
|||
rb_encoding *
|
||||
rb_enc_from_index(int index)
|
||||
{
|
||||
if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) {
|
||||
if (UNLIKELY(index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK))) {
|
||||
return 0;
|
||||
}
|
||||
return enc_table.list[index].enc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue