diff options
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); |