diff options
author | dundargoc <gocdundar@gmail.com> | 2022-11-26 18:57:46 +0100 |
---|---|---|
committer | dundargoc <gocdundar@gmail.com> | 2022-11-28 14:53:35 +0100 |
commit | 3b96ccf7d35be90e49029dec76344d3d92ad91dc (patch) | |
tree | f4768eb7d7be52402ccd55e3e4e04aecceab3e42 /src/nvim/mbyte.c | |
parent | b2bb3973d9c7f25acfead2718d74fcf5b1e4551e (diff) | |
download | rneovim-3b96ccf7d35be90e49029dec76344d3d92ad91dc.tar.gz rneovim-3b96ccf7d35be90e49029dec76344d3d92ad91dc.tar.bz2 rneovim-3b96ccf7d35be90e49029dec76344d3d92ad91dc.zip |
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index c7734e45e7..f48955c904 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -367,15 +367,15 @@ static int enc_canon_search(const char *name) // Find canonical encoding "name" in the list and return its properties. // Returns 0 if not found. -int enc_canon_props(const char_u *name) +int enc_canon_props(const char *name) FUNC_ATTR_PURE { int i = enc_canon_search((char *)name); if (i >= 0) { return enc_canon_table[i].prop; - } else if (STRNCMP(name, "2byte-", 6) == 0) { + } else if (strncmp(name, "2byte-", 6) == 0) { return ENC_DBCS; - } else if (STRNCMP(name, "8bit-", 5) == 0 || STRNCMP(name, "iso-8859-", 9) == 0) { + } else if (strncmp(name, "8bit-", 5) == 0 || strncmp(name, "iso-8859-", 9) == 0) { return ENC_8BIT; } return 0; @@ -395,10 +395,10 @@ int bomb_size(void) if (*curbuf->b_p_fenc == NUL || strcmp(curbuf->b_p_fenc, "utf-8") == 0) { n = 3; - } else if (STRNCMP(curbuf->b_p_fenc, "ucs-2", 5) == 0 - || STRNCMP(curbuf->b_p_fenc, "utf-16", 6) == 0) { + } else if (strncmp(curbuf->b_p_fenc, "ucs-2", 5) == 0 + || strncmp(curbuf->b_p_fenc, "utf-16", 6) == 0) { n = 2; - } else if (STRNCMP(curbuf->b_p_fenc, "ucs-4", 5) == 0) { + } else if (strncmp(curbuf->b_p_fenc, "ucs-4", 5) == 0) { n = 4; } } @@ -1888,7 +1888,7 @@ void utf_find_illegal(void) char_u *tofree = NULL; vimconv.vc_type = CONV_NONE; - if (enc_canon_props((char_u *)curbuf->b_p_fenc) & ENC_8BIT) { + if (enc_canon_props(curbuf->b_p_fenc) & ENC_8BIT) { // 'encoding' is "utf-8" but we are editing a 8-bit encoded file, // possibly a utf-8 file with illegal bytes. Setup for conversion // from utf-8 to 'fileencoding'. @@ -2103,10 +2103,10 @@ const char *mb_unescape(const char **const pp) /// Skip the Vim specific head of a 'encoding' name. char *enc_skip(char *p) { - if (STRNCMP(p, "2byte-", 6) == 0) { + if (strncmp(p, "2byte-", 6) == 0) { return p + 6; } - if (STRNCMP(p, "8bit-", 5) == 0) { + if (strncmp(p, "8bit-", 5) == 0) { return p + 5; } return p; @@ -2143,24 +2143,24 @@ char *enc_canonize(char *enc) p = enc_skip(r); // Change "microsoft-cp" to "cp". Used in some spell files. - if (STRNCMP(p, "microsoft-cp", 12) == 0) { + if (strncmp(p, "microsoft-cp", 12) == 0) { STRMOVE(p, p + 10); } // "iso8859" -> "iso-8859" - if (STRNCMP(p, "iso8859", 7) == 0) { + if (strncmp(p, "iso8859", 7) == 0) { STRMOVE(p + 4, p + 3); p[3] = '-'; } // "iso-8859n" -> "iso-8859-n" - if (STRNCMP(p, "iso-8859", 8) == 0 && p[8] != '-') { + if (strncmp(p, "iso-8859", 8) == 0 && p[8] != '-') { STRMOVE(p + 9, p + 8); p[8] = '-'; } // "latin-N" -> "latinN" - if (STRNCMP(p, "latin-", 6) == 0) { + if (strncmp(p, "latin-", 6) == 0) { STRMOVE(p + 5, p + 6); } @@ -2423,8 +2423,8 @@ int convert_setup_ext(vimconv_T *vcp, char *from, bool from_unicode_is_utf8, cha return OK; } - from_prop = enc_canon_props((char_u *)from); - to_prop = enc_canon_props((char_u *)to); + from_prop = enc_canon_props(from); + to_prop = enc_canon_props(to); if (from_unicode_is_utf8) { from_is_utf8 = from_prop & ENC_UNICODE; } else { |