patch 8.0.0520: using a function pointer while the function is known
Problem: Using a function pointer instead of the actual function, which we
know.
Solution: Change mb_ functions to utf_ functions when already checked for
Unicode. (Dominique Pelle, closes #1582)
diff --git a/src/screen.c b/src/screen.c
index 6a7284b..ceb30e3 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4119,7 +4119,7 @@
c = c_extra;
#ifdef FEAT_MBYTE
mb_c = c; /* doesn't handle non-utf-8 multi-byte! */
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -4140,7 +4140,7 @@
{
/* If the UTF-8 character is more than one byte:
* Decode it into "mb_c". */
- mb_l = (*mb_ptr2len)(p_extra);
+ mb_l = utfc_ptr2len(p_extra);
mb_utf8 = FALSE;
if (mb_l > n_extra)
mb_l = 1;
@@ -4219,7 +4219,7 @@
{
/* If the UTF-8 character is more than one byte: Decode it
* into "mb_c". */
- mb_l = (*mb_ptr2len)(ptr);
+ mb_l = utfc_ptr2len(ptr);
mb_utf8 = FALSE;
if (mb_l > 1)
{
@@ -4612,7 +4612,7 @@
}
#ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -4634,7 +4634,7 @@
}
#ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -4765,7 +4765,7 @@
saved_attr2 = char_attr; /* save current attr */
#ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -4839,7 +4839,7 @@
}
#ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -5003,7 +5003,7 @@
}
# ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -5110,7 +5110,7 @@
extra_attr = HL_ATTR(HLF_AT);
}
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;
@@ -5383,7 +5383,7 @@
char_attr = HL_ATTR(HLF_AT);
#ifdef FEAT_MBYTE
mb_c = c;
- if (enc_utf8 && (*mb_char2len)(c) > 1)
+ if (enc_utf8 && utf_char2len(c) > 1)
{
mb_utf8 = TRUE;
u8cc[0] = 0;