]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0520: using a function pointer while the function is known v8.0.0520
authorBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 15:30:27 +0000 (17:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 15:30:27 +0000 (17:30 +0200)
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)

src/message.c
src/misc2.c
src/regexp.c
src/regexp_nfa.c
src/screen.c
src/spell.c
src/version.c

index a4dd746d0a54f8d8422203b17edc3d61005cdf89..a9a66698d2f3e158054653dff40e915e2fc5709e 100644 (file)
@@ -315,7 +315,7 @@ trunc_string(
        for (;;)
        {
            do
-               half = half - (*mb_head_off)(s, s + half - 1) - 1;
+               half = half - utf_head_off(s, s + half - 1) - 1;
            while (half > 0 && utf_iscomposing(utf_ptr2char(s + half)));
            n = ptr2cells(s + half);
            if (len + n > room || half == 0)
index 2ded997de1d0f303a914b7c8691c3cd6833297a8..2f9fed57a41c7abe9facc920ef57cc98f4266c30 100644 (file)
@@ -1874,7 +1874,7 @@ vim_strchr(char_u *string, int c)
     {
        while (*p != NUL)
        {
-           int l = (*mb_ptr2len)(p);
+           int l = utfc_ptr2len(p);
 
            /* Avoid matching an illegal byte here. */
            if (utf_ptr2char(p) == c && l > 1)
index b4fe7d7ebfd28be88fba8bbe90ecb37d3ecb5f48..e1f6484c00a62f6696ba7d5295b0108101627570 100644 (file)
@@ -4732,7 +4732,7 @@ regmatch(
                    break;
                }
                if (enc_utf8)
-                   opndc = mb_ptr2char(opnd);
+                   opndc = utf_ptr2char(opnd);
                if (enc_utf8 && utf_iscomposing(opndc))
                {
                    /* When only a composing char is given match at any
@@ -4741,7 +4741,7 @@ regmatch(
                    for (i = 0; reginput[i] != NUL;
                                                i += utf_ptr2len(reginput + i))
                    {
-                       inpc = mb_ptr2char(reginput + i);
+                       inpc = utf_ptr2char(reginput + i);
                        if (!utf_iscomposing(inpc))
                        {
                            if (i > 0)
@@ -4750,7 +4750,7 @@ regmatch(
                        else if (opndc == inpc)
                        {
                            /* Include all following composing chars. */
-                           len = i + mb_ptr2len(reginput + i);
+                           len = i + utfc_ptr2len(reginput + i);
                            status = RA_MATCH;
                            break;
                        }
index e6d8255e9cdccfbc9616b40bfaa7592fb3009823..120861a46b575b0c9031d1ac76573993f05a41dc 100644 (file)
@@ -1974,7 +1974,7 @@ collection:
 nfa_do_multibyte:
                /* plen is length of current char with composing chars */
                if (enc_utf8 && ((*mb_char2len)(c)
-                           != (plen = (*mb_ptr2len)(old_regparse))
+                           != (plen = utfc_ptr2len(old_regparse))
                                                       || utf_iscomposing(c)))
                {
                    int i = 0;
index 6a7284bb46aa6b6fe0af9d632ff97b25c28382f9..ceb30e337deb5b382a1a9eef7c4ffb8c2d5f7ce6 100644 (file)
@@ -4119,7 +4119,7 @@ win_line(
                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 @@ win_line(
                    {
                        /* 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 @@ win_line(
                {
                    /* 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 @@ win_line(
                    }
 #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 @@ win_line(
                    }
 #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 @@ win_line(
                        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 @@ win_line(
                    }
 #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 @@ win_line(
                }
 # 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 @@ win_line(
                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 @@ win_line(
            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;
index 1700bba0e4c4c02ef485866e5bd4cb63b8e6c6a9..ed0db8c8aa56df7e44844b1a5d938fc68a70c1de 100644 (file)
@@ -1208,7 +1208,7 @@ can_compound(slang_T *slang, char_u *word, char_u *flags)
        /* Need to convert the single byte flags to utf8 characters. */
        p = uflags;
        for (i = 0; flags[i] != NUL; ++i)
-           p += mb_char2bytes(flags[i], p);
+           p += utf_char2bytes(flags[i], p);
        *p = NUL;
        p = uflags;
     }
@@ -5117,11 +5117,11 @@ suggest_trie_walk(
                                 * SCORE_SUBCOMP. */
                                if (enc_utf8
                                        && utf_iscomposing(
-                                           mb_ptr2char(tword
+                                           utf_ptr2char(tword
                                                + sp->ts_twordlen
                                                           - sp->ts_tcharlen))
                                        && utf_iscomposing(
-                                           mb_ptr2char(fword
+                                           utf_ptr2char(fword
                                                        + sp->ts_fcharstart)))
                                    sp->ts_score -=
                                                  SCORE_SUBST - SCORE_SUBCOMP;
index 36adf25a547e6ead425d9a6cde4ad8fe5bf664b9..5705d983748b52502fb377de0e340a163ef1ee60 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    520,
 /**/
     519,
 /**/