diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-06 22:00:13 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-06 22:00:13 +0200 |
commit | 1614a14901558ca091329315d14a7d5e1b53aa47 (patch) | |
tree | 324ceeba0f8d5bda2f270b591a1beeed8e74125d /src/spellsuggest.c | |
parent | 524f3b19ae16e08350010b5effe38d0637349285 (diff) | |
download | vim-git-1614a14901558ca091329315d14a7d5e1b53aa47.tar.gz |
patch 8.1.2120: some MB_ macros are more complicated than necessaryv8.1.2120
Problem: Some MB_ macros are more complicated than necessary. (Dominique
Pelle)
Solution: Simplify the macros. Expand inline.
Diffstat (limited to 'src/spellsuggest.c')
-rw-r--r-- | src/spellsuggest.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/spellsuggest.c b/src/spellsuggest.c index 41f4a73b1..a5f8b92fa 100644 --- 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); } |