diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-02-13 16:01:06 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-02-13 21:12:10 +0000 |
commit | dc5191d6952246be6717a76c193abe1bc55128b7 (patch) | |
tree | 3abd9e917f21f9120ec3ce0c552b06eeb635fee8 /prism/encoding.c | |
parent | a5869e5d8c1130b5b0261bc995a545be5fbff27e (diff) | |
download | ruby-dc5191d6952246be6717a76c193abe1bc55128b7.tar.gz |
[ruby/prism] Fix KOI-8 char width check
https://github.com/ruby/prism/commit/06d3747c5b
Diffstat (limited to 'prism/encoding.c')
-rw-r--r-- | prism/encoding.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/prism/encoding.c b/prism/encoding.c index c8e0941d1d..981945caba 100644 --- a/prism/encoding.c +++ b/prism/encoding.c @@ -4187,15 +4187,6 @@ pm_encoding_gbk_char_width(const uint8_t *b, ptrdiff_t n) { } /** - * Returns the size of the next character in the KOI-8 encoding. This means - * checking if it's a valid codepoint in KOI-8 and if it is returning 1. - */ -static size_t -pm_encoding_koi8_char_width(const uint8_t *b, PRISM_ATTRIBUTE_UNUSED ptrdiff_t n) { - return ((*b >= 0x20 && *b <= 0x7E) || (*b >= 0x80)) ? 1 : 0; -} - -/** * Returns the size of the next character in the Shift_JIS encoding, or 0 if a * character cannot be decoded from the given bytes. */ @@ -4652,7 +4643,7 @@ const pm_encoding_t pm_encodings[] = { }, [PM_ENCODING_KOI8_R] = { .name = "KOI8-R", - .char_width = pm_encoding_koi8_char_width, + .char_width = pm_encoding_single_char_width, .alnum_char = pm_encoding_koi8_r_alnum_char, .alpha_char = pm_encoding_koi8_r_alpha_char, .isupper_char = pm_encoding_koi8_r_isupper_char, @@ -4660,7 +4651,7 @@ const pm_encoding_t pm_encodings[] = { }, [PM_ENCODING_KOI8_U] = { .name = "KOI8-U", - .char_width = pm_encoding_koi8_char_width, + .char_width = pm_encoding_single_char_width, .alnum_char = pm_encoding_koi8_u_alnum_char, .alpha_char = pm_encoding_koi8_u_alpha_char, .isupper_char = pm_encoding_koi8_u_isupper_char, |