Mercurial > vim
diff src/spellsuggest.c @ 18251:c8a53c0daeed v8.1.2120
patch 8.1.2120: some MB_ macros are more complicated than necessary
Commit: https://github.com/vim/vim/commit/1614a14901558ca091329315d14a7d5e1b53aa47
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 6 22:00:13 2019 +0200
patch 8.1.2120: some MB_ macros are more complicated than necessary
Problem: Some MB_ macros are more complicated than necessary. (Dominique
Pelle)
Solution: Simplify the macros. Expand inline.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 06 Oct 2019 22:15:04 +0200 |
parents | 6e53d83e021d |
children | 9e6d5a4abb1c |
line wrap: on
line diff
--- a/src/spellsuggest.c +++ b/src/spellsuggest.c @@ -1782,7 +1782,7 @@ suggest_trie_walk( { int l; - l = MB_PTR2LEN(fword + sp->ts_fidx); + l = mb_ptr2len(fword + sp->ts_fidx); if (fword_ends) { // Copy the skipped character to preword. @@ -1937,7 +1937,7 @@ suggest_trie_walk( // Correct ts_fidx for the byte length of the // character (we didn't check that before). sp->ts_fidx = sp->ts_fcharstart - + MB_PTR2LEN( + + mb_ptr2len( fword + sp->ts_fcharstart); // For changing a composing character adjust // the score from SCORE_SUBST to @@ -2053,7 +2053,7 @@ suggest_trie_walk( if (has_mbyte) { c = mb_ptr2char(fword + sp->ts_fidx); - stack[depth].ts_fidx += MB_PTR2LEN(fword + sp->ts_fidx); + stack[depth].ts_fidx += mb_ptr2len(fword + sp->ts_fidx); if (enc_utf8 && utf_iscomposing(c)) stack[depth].ts_score -= SCORE_DEL - SCORE_DELCOMP; else if (c == mb_ptr2char(fword + stack[depth].ts_fidx)) @@ -2266,9 +2266,9 @@ suggest_trie_walk( p = fword + sp->ts_fidx; if (has_mbyte) { - n = MB_PTR2LEN(p); + n = mb_ptr2len(p); c = mb_ptr2char(p + n); - mch_memmove(p + MB_PTR2LEN(p + n), p, n); + mch_memmove(p + mb_ptr2len(p + n), p, n); mb_char2bytes(c, p); } else @@ -2354,11 +2354,11 @@ suggest_trie_walk( p = fword + sp->ts_fidx; if (has_mbyte) { - n = MB_PTR2LEN(p); + n = mb_ptr2len(p); c2 = mb_ptr2char(p + n); - fl = MB_PTR2LEN(p + n); + fl = mb_ptr2len(p + n); c = mb_ptr2char(p + n + fl); - tl = MB_PTR2LEN(p + n + fl); + tl = mb_ptr2len(p + n + fl); mch_memmove(p + fl + tl, p, n); mb_char2bytes(c, p); mb_char2bytes(c2, p + tl); @@ -2427,10 +2427,10 @@ suggest_trie_walk( p = fword + sp->ts_fidx; if (has_mbyte) { - n = MB_PTR2LEN(p); - n += MB_PTR2LEN(p + n); + n = mb_ptr2len(p); + n += mb_ptr2len(p + n); c = mb_ptr2char(p + n); - tl = MB_PTR2LEN(p + n); + tl = mb_ptr2len(p + n); mch_memmove(p + tl, p, n); mb_char2bytes(c, p); } @@ -2489,9 +2489,9 @@ suggest_trie_walk( if (has_mbyte) { c = mb_ptr2char(p); - tl = MB_PTR2LEN(p); - n = MB_PTR2LEN(p + tl); - n += MB_PTR2LEN(p + tl + n); + tl = mb_ptr2len(p); + n = mb_ptr2len(p + tl); + n += mb_ptr2len(p + tl + n); mch_memmove(p, p + tl, n); mb_char2bytes(c, p + n); }