diff options
author | Lourens Naudé <lourens@bearmetal.eu> | 2019-04-13 17:39:05 +0100 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-23 16:45:54 +0900 |
commit | 009ec37a47e2f2b5e7f928004fbc3403f0bd8abe (patch) | |
tree | d257ebeacb4437d6fcb2a74443b681d55892f2bc /encoding.c | |
parent | 6546aed4757be07f4932326e1eb41a5d69141acf (diff) |
Let the index boundary check in rb_enc_from_index be flagged as unlikely
[Misc #15806]
Closes: https://github.com/ruby/ruby/pull/2128
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c index 9655213f73..908a6458a0 100644 --- a/encoding.c +++ b/encoding.c @@ -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; |