diff options
author | ZviRackover <zvirack@gmail.com> | 2018-09-02 00:58:30 +0300 |
---|---|---|
committer | ZviRackover <zvirack@gmail.com> | 2018-09-09 10:45:50 +0300 |
commit | cbdbc4f63d68a6b17b9eea5c67130e37d3d0f278 (patch) | |
tree | 5d82993e830a807647ec81aad1d5a391e4490cb0 /src/nvim/spell.c | |
parent | 50eadfe2e991a0bb5fe0f98377d91702f0a20492 (diff) | |
download | rneovim-cbdbc4f63d68a6b17b9eea5c67130e37d3d0f278.tar.gz rneovim-cbdbc4f63d68a6b17b9eea5c67130e37d3d0f278.tar.bz2 rneovim-cbdbc4f63d68a6b17b9eea5c67130e37d3d0f278.zip |
Refactor: Remove occurences of mb_char2bytes
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r-- | src/nvim/spell.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 0ac1dd95e2..9a6f86d25e 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2684,7 +2684,7 @@ int spell_casefold(char_u *str, int len, char_u *buf, int buflen) return FAIL; } c = mb_cptr2char_adv((const char_u **)&p); - outi += mb_char2bytes(SPELL_TOFOLD(c), buf + outi); + outi += utf_char2bytes(SPELL_TOFOLD(c), buf + outi); } buf[outi] = NUL; } else { @@ -3434,7 +3434,7 @@ void onecap_copy(char_u *word, char_u *wcopy, bool upper) c = SPELL_TOFOLD(c); } if (has_mbyte) { - l = mb_char2bytes(c, wcopy); + l = utf_char2bytes(c, wcopy); } else { l = 1; wcopy[0] = c; @@ -3469,7 +3469,7 @@ static void allcap_copy(char_u *word, char_u *wcopy) if (has_mbyte) { if (d - wcopy >= MAXWLEN - MB_MAXBYTES) break; - d += mb_char2bytes(c, d); + d += utf_char2bytes(c, d); } else { if (d - wcopy >= MAXWLEN - 1) break; @@ -4546,7 +4546,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so if (has_mbyte) { fl = mb_char2len(c2); memmove(p, p + n, fl); - mb_char2bytes(c, p + fl); + utf_char2bytes(c, p + fl); stack[depth].ts_fidxtry = sp->ts_fidx + n + fl; } else { p[0] = c2; @@ -4565,7 +4565,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so n = MB_PTR2LEN(p); c = utf_ptr2char(p + n); memmove(p + MB_PTR2LEN(p + n), p, n); - mb_char2bytes(c, p); + utf_char2bytes(c, p); // FALLTHROUGH @@ -4607,8 +4607,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so if (has_mbyte) { tl = mb_char2len(c3); memmove(p, p + n + fl, tl); - mb_char2bytes(c2, p + tl); - mb_char2bytes(c, p + fl + tl); + utf_char2bytes(c2, p + tl); + utf_char2bytes(c, p + fl + tl); stack[depth].ts_fidxtry = sp->ts_fidx + n + fl + tl; } else { p[0] = p[2]; @@ -4630,8 +4630,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so c = utf_ptr2char(p + n + fl); tl = MB_PTR2LEN(p + n + fl); memmove(p + fl + tl, p, n); - mb_char2bytes(c, p); - mb_char2bytes(c2, p + tl); + utf_char2bytes(c, p); + utf_char2bytes(c2, p + tl); p = p + tl; if (!soundfold && !spell_iswordp(p, curwin)) { @@ -4677,7 +4677,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so c = utf_ptr2char(p + n); tl = MB_PTR2LEN(p + n); memmove(p + tl, p, n); - mb_char2bytes(c, p); + utf_char2bytes(c, p); // Rotate three bytes right: "123" -> "312". We change "fword" // here, it's changed back afterwards at STATE_UNROT3R. @@ -4698,7 +4698,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so c = utf_ptr2char(p + n); tl = MB_CPTR2LEN(p + n); memmove(p + tl, p, n); - mb_char2bytes(c, p); + utf_char2bytes(c, p); stack[depth].ts_fidxtry = sp->ts_fidx + n + tl; } else { PROF_STORE(sp->ts_state) @@ -4714,7 +4714,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so n = MB_PTR2LEN(p + tl); n += MB_PTR2LEN(p + tl + n); memmove(p, p + tl, n); - mb_char2bytes(c, p + n); + utf_char2bytes(c, p + n); // FALLTHROUGH @@ -5539,7 +5539,7 @@ static bool similar_chars(slang_T *slang, int c1, int c2) hashitem_T *hi; if (c1 >= 256) { - buf[mb_char2bytes(c1, buf)] = 0; + buf[utf_char2bytes(c1, buf)] = 0; hi = hash_find(&slang->sl_map_hash, buf); if (HASHITEM_EMPTY(hi)) { m1 = 0; @@ -5554,7 +5554,7 @@ static bool similar_chars(slang_T *slang, int c1, int c2) } if (c2 >= 256) { - buf[mb_char2bytes(c2, buf)] = 0; + buf[utf_char2bytes(c2, buf)] = 0; hi = hash_find(&slang->sl_map_hash, buf); if (HASHITEM_EMPTY(hi)) { m2 = 0; @@ -5917,7 +5917,7 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res) } if (c != NUL && c != prevc) { - ri += mb_char2bytes(c, res + ri); + ri += utf_char2bytes(c, res + ri); if (ri + MB_MAXBYTES > MAXWLEN) break; prevc = c; @@ -6440,7 +6440,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res) // Convert wide characters in "wres" to a multi-byte string in "res". l = 0; for (n = 0; n < reslen; ++n) { - l += mb_char2bytes(wres[n], res + l); + l += utf_char2bytes(wres[n], res + l); if (l + MB_MAXBYTES > MAXWLEN) break; } |