diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2018-09-11 09:03:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 09:03:09 +0200 |
commit | d6b3c09129dee687b33db719be5bb3e2b51deccc (patch) | |
tree | b22b43c8a0f117a6cf6b61558c83fe3131f791f0 /src/nvim/spellfile.c | |
parent | 036051b218760c6c8ff70b2ff347916acab993ff (diff) | |
parent | 329cfc3303cffd5c9aad7b2ad7f4323354d68b0d (diff) | |
download | rneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.tar.gz rneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.tar.bz2 rneovim-d6b3c09129dee687b33db719be5bb3e2b51deccc.zip |
Merge pull request #8945 from ZviRackover/fix-7401-step5
mbyte: remove mb_char2bytes
Diffstat (limited to 'src/nvim/spellfile.c')
-rw-r--r-- | src/nvim/spellfile.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 21a86c6946..f52ae61534 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -1457,12 +1457,10 @@ static int read_compound(FILE *fd, slang_T *slang, int len) *pp++ = '|'; atstart = 1; } else { // normal char, "[abc]" and '*' are copied as-is - if (c == '?' || c == '+' || c == '~') + if (c == '?' || c == '+' || c == '~') { *pp++ = '\\'; // "a?" becomes "a\?", "a+" becomes "a\+" - if (enc_utf8) - pp += mb_char2bytes(c, pp); - else - *pp++ = c; + } + pp += utf_char2bytes(c, pp); } } @@ -4244,11 +4242,8 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname) // Form the <folchars> string first, we need to know its length. size_t l = 0; - for (size_t i = 128; i < 256; ++i) { - if (has_mbyte) - l += (size_t)mb_char2bytes(spelltab.st_fold[i], folchars + l); - else - folchars[l++] = spelltab.st_fold[i]; + for (size_t i = 128; i < 256; i++) { + l += (size_t)utf_char2bytes(spelltab.st_fold[i], folchars + l); } put_bytes(fd, 1 + 128 + 2 + l, 4); // <sectionlen> @@ -5710,9 +5705,9 @@ static void set_map_str(slang_T *lp, char_u *map) hashitem_T *hi; b = xmalloc(cl + headcl + 2); - mb_char2bytes(c, b); + utf_char2bytes(c, b); b[cl] = NUL; - mb_char2bytes(headc, b + cl + 1); + utf_char2bytes(headc, b + cl + 1); b[cl + 1 + headcl] = NUL; hash = hash_hash(b); hi = hash_lookup(&lp->sl_map_hash, (const char *)b, STRLEN(b), hash); |