diff options
| author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-04-02 10:11:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-02 16:11:42 +0800 |
| commit | d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f (patch) | |
| tree | cfe7dd74ad588e935ea7613fc91c99b819aa99ad | |
| parent | 9084948893f9c1669ab56061c8d04adabbb6c3cf (diff) | |
| download | rneovim-d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f.tar.gz rneovim-d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f.tar.bz2 rneovim-d510bfbc8e447b1a60d5ec7faaa8f440eb4ef56f.zip | |
refactor: remove char_u (#22829)
Closes https://github.com/neovim/neovim/issues/459
40 files changed, 340 insertions, 1965 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 63459495f8..2be8ccc456 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -55,7 +55,7 @@ static bool chartab_initialized = false; ((chartab)[(unsigned)(c) >> 6] & (1ull << ((c) & 0x3f))) // Table used below, see init_chartab() for an explanation -static char_u g_chartab[256]; +static uint8_t g_chartab[256]; // Flags for g_chartab[]. #define CT_CELL_MASK 0x07 ///< mask: nr of display cells (1, 2 or 4) @@ -286,7 +286,7 @@ void trans_characters(char *buf, int bufsize) if ((trs_len = utfc_ptr2len(buf)) > 1) { len -= trs_len; } else { - trs = (char *)transchar_byte((uint8_t)(*buf)); + trs = transchar_byte((uint8_t)(*buf)); trs_len = (int)strlen(trs); if (trs_len > 1) { @@ -532,7 +532,7 @@ char *str_foldcase(char *str, int orglen, char *buf, int buflen) // Does NOT work for multi-byte characters, c must be <= 255. // Also doesn't work for the first byte of a multi-byte, "c" must be a // character! -static char_u transchar_charbuf[11]; +static uint8_t transchar_charbuf[11]; /// Translate a character into a printable one, leaving printable ASCII intact /// @@ -543,10 +543,10 @@ static char_u transchar_charbuf[11]; /// @return translated character into a static buffer. char *transchar(int c) { - return (char *)transchar_buf(curbuf, c); + return transchar_buf(curbuf, c); } -char_u *transchar_buf(const buf_T *buf, int c) +char *transchar_buf(const buf_T *buf, int c) { int i = 0; if (IS_SPECIAL(c)) { @@ -560,14 +560,14 @@ char_u *transchar_buf(const buf_T *buf, int c) if ((!chartab_initialized && (c >= ' ' && c <= '~')) || ((c <= 0xFF) && vim_isprintc_strict(c))) { // printable character - transchar_charbuf[i] = (char_u)c; + transchar_charbuf[i] = (uint8_t)c; transchar_charbuf[i + 1] = NUL; } else if (c <= 0xFF) { - transchar_nonprint(buf, transchar_charbuf + i, c); + transchar_nonprint(buf, (char *)transchar_charbuf + i, c); } else { transchar_hex((char *)transchar_charbuf + i, c); } - return transchar_charbuf; + return (char *)transchar_charbuf; } /// Like transchar(), but called with a byte instead of a character. @@ -577,7 +577,7 @@ char_u *transchar_buf(const buf_T *buf, int c) /// @param[in] c Byte to translate. /// /// @return pointer to translated character in transchar_charbuf. -char_u *transchar_byte(const int c) +char *transchar_byte(const int c) FUNC_ATTR_WARN_UNUSED_RESULT { return transchar_byte_buf(curbuf, c); @@ -590,12 +590,12 @@ char_u *transchar_byte(const int c) /// @param[in] c Byte to translate. /// /// @return pointer to translated character in transchar_charbuf. -char_u *transchar_byte_buf(const buf_T *buf, const int c) +char *transchar_byte_buf(const buf_T *buf, const int c) FUNC_ATTR_WARN_UNUSED_RESULT { if (c >= 0x80) { - transchar_nonprint(buf, transchar_charbuf, c); - return transchar_charbuf; + transchar_nonprint(buf, (char *)transchar_charbuf, c); + return (char *)transchar_charbuf; } return transchar_buf(buf, c); } @@ -609,7 +609,7 @@ char_u *transchar_byte_buf(const buf_T *buf, const int c) /// at least 5 bytes (conversion result + NUL). /// @param[in] c Character to convert. NUL is assumed to be NL according to /// `:h NL-used-for-NUL`. -void transchar_nonprint(const buf_T *buf, char_u *charbuf, int c) +void transchar_nonprint(const buf_T *buf, char *charbuf, int c) { if (c == NL) { // we use newline in place of a NUL @@ -622,12 +622,12 @@ void transchar_nonprint(const buf_T *buf, char_u *charbuf, int c) if (dy_flags & DY_UHEX || c > 0x7f) { // 'display' has "uhex" - transchar_hex((char *)charbuf, c); + transchar_hex(charbuf, c); } else { // 0x00 - 0x1f and 0x7f charbuf[0] = '^'; // DEL displayed as ^? - charbuf[1] = (char_u)(c ^ 0x40); + charbuf[1] = (char)(uint8_t)(c ^ 0x40); charbuf[2] = NUL; } diff --git a/src/nvim/charset.h b/src/nvim/charset.h index e1ef06ef1d..f98ed94b87 100644 --- a/src/nvim/charset.h +++ b/src/nvim/charset.h @@ -54,6 +54,6 @@ static inline bool vim_isbreak(int c) /// Used very often if 'linebreak' is set static inline bool vim_isbreak(int c) { - return breakat_flags[(char_u)c]; + return breakat_flags[(uint8_t)c]; } #endif // NVIM_CHARSET_H diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index 6d8cf1c7e1..caad88c212 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -2371,7 +2371,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange, mb_c = c; mb_utf8 = check_mb_utf8(&c, u8cc); } else if (c != NUL) { - wlv.p_extra = (char *)transchar_buf(wp->w_buffer, c); + wlv.p_extra = transchar_buf(wp->w_buffer, c); if (wlv.n_extra == 0) { wlv.n_extra = byte2cells(c) - 1; } diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 26101d06ed..c551ec2726 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1955,7 +1955,7 @@ static void insert_special(int c, int allow_modmask, int ctrlv) allow_modmask = true; } if (IS_SPECIAL(c) || (mod_mask && allow_modmask)) { - char *p = (char *)get_special_key_name(c, mod_mask); + char *p = get_special_key_name(c, mod_mask); int len = (int)strlen(p); c = (uint8_t)p[len - 1]; if (len > 2) { diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 25d383d8ea..4286e16eb1 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -6197,7 +6197,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } # else char *v = os_realpath(fname, NULL); - rettv->vval.v_string = (char_u *)(v == NULL ? xstrdup(fname) : v); + rettv->vval.v_string = v == NULL ? xstrdup(fname) : v; # endif #endif diff --git a/src/nvim/eval/typval_defs.h b/src/nvim/eval/typval_defs.h index 4615198441..80432271b0 100644 --- a/src/nvim/eval/typval_defs.h +++ b/src/nvim/eval/typval_defs.h @@ -206,7 +206,7 @@ typedef struct { struct { \ typval_T di_tv; /* Structure that holds scope dictionary itself. */ \ uint8_t di_flags; /* Flags. */ \ - char_u di_key[__VA_ARGS__]; /* Key value. */ /* NOLINT(runtime/arrays)*/ \ + char di_key[__VA_ARGS__]; /* Key value. */ /* NOLINT(runtime/arrays)*/ \ } /// Structure to hold a scope dictionary diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 13779f4173..40bca9acc1 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -90,7 +90,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int * bool mustend = false; char *arg = *argp; char *p = arg; - char_u c; + uint8_t c; int i; if (newargs != NULL) { @@ -128,7 +128,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int * } if (newargs != NULL) { ga_grow(newargs, 1); - c = (char_u)(*p); + c = (uint8_t)(*p); *p = NUL; arg = xstrdup(arg); @@ -159,7 +159,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int * while (p > expr && ascii_iswhite(p[-1])) { p--; } - c = (char_u)(*p); + c = (uint8_t)(*p); *p = NUL; expr = xstrdup(expr); ((char **)(default_args->ga_data))[default_args->ga_len] = expr; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 621cb764f4..705f0fe83d 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -149,7 +149,7 @@ void do_ascii(const exarg_T *const eap) char buf1[20]; if (vim_isprintc_strict(c) && (c < ' ' || c > '~')) { char buf3[7]; - transchar_nonprint(curbuf, (char_u *)buf3, c); + transchar_nonprint(curbuf, buf3, c); vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3); } else { buf1[0] = NUL; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 5112505eda..bd7ddbf567 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2117,7 +2117,7 @@ static int command_line_handle_key(CommandLineState *s) // put the character in the command line if (IS_SPECIAL(s->c) || mod_mask != 0) { - put_on_cmdline((char *)get_special_key_name(s->c, mod_mask), -1, true); + put_on_cmdline(get_special_key_name(s->c, mod_mask), -1, true); } else { int j = utf_char2bytes(s->c, IObuff); IObuff[j] = NUL; // exclude composing chars diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index e27c7c4349..d91e2dfeeb 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -794,7 +794,7 @@ char *vim_findfile(void *search_ctx_arg) ) { #ifdef FF_VERBOSE if (ff_check_visited(&search_ctx->ffsc_visited_list->ffvl_visited_list, - file_path, (char_u *)"") == FAIL) { + file_path, "") == FAIL) { if (p_verbose >= 5) { verbose_enter_scroll(); smsg("Already: %s", file_path); diff --git a/src/nvim/generators/gen_ex_cmds.lua b/src/nvim/generators/gen_ex_cmds.lua index 935d7b333e..26edd33604 100644 --- a/src/nvim/generators/gen_ex_cmds.lua +++ b/src/nvim/generators/gen_ex_cmds.lua @@ -41,7 +41,7 @@ static const uint16_t cmdidxs1[%u] = { -- Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they -- fit in a byte. local cmdidxs2_out = string.format([[ -static const char_u cmdidxs2[%u][%u] = { +static const uint8_t cmdidxs2[%u][%u] = { /* a b c d e f g h i j k l m n o p q r s t u v w x y z */ ]], a_to_z, a_to_z) diff --git a/src/nvim/generators/gen_options.lua b/src/nvim/generators/gen_options.lua index edb7dae159..54b97c5286 100644 --- a/src/nvim/generators/gen_options.lua +++ b/src/nvim/generators/gen_options.lua @@ -139,7 +139,7 @@ local dump_option = function(i, o) w(get_cond(o.enable_if)) end if o.varname then - w(' .var=(char_u *)&' .. o.varname) + w(' .var=(char *)&' .. o.varname) elseif #o.scope == 1 and o.scope[1] == 'window' then w(' .var=VAR_WIN') end diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c index f3d379c2e9..8eec9014f7 100644 --- a/src/nvim/keycodes.c +++ b/src/nvim/keycodes.c @@ -34,18 +34,18 @@ static const struct modmasktable { uint16_t mod_mask; ///< Bit-mask for particular key modifier. uint16_t mod_flag; ///< Bit(s) for particular key modifier. - char_u name; ///< Single letter name of modifier. + char name; ///< Single letter name of modifier. } mod_mask_table[] = { - { MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'M' }, - { MOD_MASK_META, MOD_MASK_META, (char_u)'T' }, - { MOD_MASK_CTRL, MOD_MASK_CTRL, (char_u)'C' }, - { MOD_MASK_SHIFT, MOD_MASK_SHIFT, (char_u)'S' }, - { MOD_MASK_MULTI_CLICK, MOD_MASK_2CLICK, (char_u)'2' }, - { MOD_MASK_MULTI_CLICK, MOD_MASK_3CLICK, (char_u)'3' }, - { MOD_MASK_MULTI_CLICK, MOD_MASK_4CLICK, (char_u)'4' }, - { MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D' }, + { MOD_MASK_ALT, MOD_MASK_ALT, 'M' }, + { MOD_MASK_META, MOD_MASK_META, 'T' }, + { MOD_MASK_CTRL, MOD_MASK_CTRL, 'C' }, + { MOD_MASK_SHIFT, MOD_MASK_SHIFT, 'S' }, + { MOD_MASK_MULTI_CLICK, MOD_MASK_2CLICK, '2' }, + { MOD_MASK_MULTI_CLICK, MOD_MASK_3CLICK, '3' }, + { MOD_MASK_MULTI_CLICK, MOD_MASK_4CLICK, '4' }, + { MOD_MASK_CMD, MOD_MASK_CMD, 'D' }, // 'A' must be the last one - { MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A' }, + { MOD_MASK_ALT, MOD_MASK_ALT, 'A' }, { 0, 0, NUL } // NOTE: when adding an entry, update MAX_KEY_NAME_LEN! }; @@ -386,7 +386,7 @@ int name_to_mod_mask(int c) { c = TOUPPER_ASC(c); for (size_t i = 0; mod_mask_table[i].mod_mask != 0; i++) { - if (c == mod_mask_table[i].name) { + if (c == (uint8_t)mod_mask_table[i].name) { return mod_mask_table[i].mod_flag; } } @@ -468,9 +468,9 @@ int handle_x_keys(const int key) } /// @return a string which contains the name of the given key when the given modifiers are down. -char_u *get_special_key_name(int c, int modifiers) +char *get_special_key_name(int c, int modifiers) { - static char_u string[MAX_KEY_NAME_LEN + 1]; + static char string[MAX_KEY_NAME_LEN + 1]; int i, idx; int table_idx; @@ -524,7 +524,7 @@ char_u *get_special_key_name(int c, int modifiers) if ((modifiers & mod_mask_table[i].mod_mask) == mod_mask_table[i].mod_flag) { string[idx++] = mod_mask_table[i].name; - string[idx++] = (char_u)'-'; + string[idx++] = '-'; } } @@ -532,18 +532,18 @@ char_u *get_special_key_name(int c, int modifiers) if (IS_SPECIAL(c)) { string[idx++] = 't'; string[idx++] = '_'; - string[idx++] = (char_u)KEY2TERMCAP0(c); - string[idx++] = KEY2TERMCAP1(c); + string[idx++] = (char)(uint8_t)KEY2TERMCAP0(c); + string[idx++] = (char)(uint8_t)KEY2TERMCAP1(c); } else { // Not a special key, only modifiers, output directly. if (utf_char2len(c) > 1) { - idx += utf_char2bytes(c, (char *)string + idx); + idx += utf_char2bytes(c, string + idx); } else if (vim_isprintc(c)) { - string[idx++] = (char_u)c; + string[idx++] = (char)(uint8_t)c; } else { s = transchar(c); while (*s) { - string[idx++] = (uint8_t)(*s++); + string[idx++] = *s++; } } } @@ -1083,7 +1083,7 @@ char *vim_strsave_escape_ks(char *p) /// vim_strsave_escape_ks(). Works in-place. void vim_unescape_ks(char *p) { - char_u *s = (char_u *)p, *d = (char_u *)p; + uint8_t *s = (uint8_t *)p, *d = (uint8_t *)p; while (*s != NUL) { if (s[0] == K_SPECIAL && s[1] == KS_SPECIAL && s[2] == KE_FILLER) { diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index 5cedc5e97d..2941d5965b 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -1189,7 +1189,7 @@ static char *translate_mapping(char *str_in, int cpo_flags) str += 2; } if (IS_SPECIAL(c) || modifiers) { // special key - ga_concat(&ga, (char *)get_special_key_name(c, modifiers)); + ga_concat(&ga, get_special_key_name(c, modifiers)); continue; // for (str) } } @@ -1436,7 +1436,7 @@ int ExpandMappings(char *pat, regmatch_T *regmatch, int *numMatches, char ***mat bool check_abbr(int c, char *ptr, int col, int mincol) { int scol; // starting column of the abbr. - char_u tb[MB_MAXBYTES + 4]; + uint8_t tb[MB_MAXBYTES + 4]; mapblock_T *mp; mapblock_T *mp2; int clen = 0; // length in characters @@ -1535,8 +1535,8 @@ bool check_abbr(int c, char *ptr, int col, int mincol) // special key code, split up if (IS_SPECIAL(c) || c == K_SPECIAL) { tb[j++] = K_SPECIAL; - tb[j++] = (char_u)K_SECOND(c); - tb[j++] = (char_u)K_THIRD(c); + tb[j++] = (uint8_t)K_SECOND(c); + tb[j++] = (uint8_t)K_THIRD(c); } else { if (c < ABBR_OFF && (c < ' ' || c > '~')) { tb[j++] = Ctrl_V; // special char needs CTRL-V @@ -1918,7 +1918,7 @@ int put_escstr(FILE *fd, char *strstart, int what) str += 2; } if (IS_SPECIAL(c) || modifiers) { // special key - if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0) { + if (fputs(get_special_key_name(c, modifiers), fd) < 0) { return FAIL; } continue; diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index fb52a11025..c580dc29e6 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -653,32 +653,32 @@ int utf_ptr2char(const char *const p_in) // // If byte sequence is illegal or incomplete, returns -1 and does not advance // "s". -static int utf_safe_read_char_adv(const char_u **s, size_t *n) +static int utf_safe_read_char_adv(const char **s, size_t *n) { if (*n == 0) { // end of buffer return 0; } - uint8_t k = utf8len_tab_zero[**s]; + uint8_t k = utf8len_tab_zero[(uint8_t)(**s)]; if (k == 1) { // ASCII character or NUL (*n)--; - return *(*s)++; + return (uint8_t)(*(*s)++); } if (k <= *n) { // We have a multibyte sequence and it isn't truncated by buffer // limits so utf_ptr2char() is safe to use. Or the first byte is // illegal (k=0), and it's also safe to use utf_ptr2char(). - int c = utf_ptr2char((char *)(*s)); + int c = utf_ptr2char(*s); // On failure, utf_ptr2char() returns the first byte, so here we // check equality with the first byte. The only non-ASCII character // which equals the first byte of its own UTF-8 representation is // U+00C3 (UTF-8: 0xC3 0x83), so need to check that special case too. // It's safe even if n=1, else we would have k=2 > n. - if (c != (int)(**s) || (c == 0xC3 && (*s)[1] == 0x83)) { + if (c != (int)((uint8_t)(**s)) || (c == 0xC3 && (uint8_t)(*s)[1] == 0x83)) { // byte sequence was successfully decoded *s += k; *n -= k; @@ -1271,7 +1271,7 @@ bool mb_isalpha(int a) return mb_islower(a) || mb_isupper(a); } -static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2) +static int utf_strnicmp(const char *s1, const char *s2, size_t n1, size_t n2) { int c1, c2, cdiff; char buffer[6]; @@ -1313,14 +1313,14 @@ static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2 if (c1 != -1 && c2 == -1) { n1 = (size_t)utf_char2bytes(utf_fold(c1), (char *)buffer); - s1 = (char_u *)buffer; + s1 = buffer; } else if (c2 != -1 && c1 == -1) { n2 = (size_t)utf_char2bytes(utf_fold(c2), (char *)buffer); - s2 = (char_u *)buffer; + s2 = buffer; } while (n1 > 0 && n2 > 0 && *s1 != NUL && *s2 != NUL) { - cdiff = (int)(*s1) - (int)(*s2); + cdiff = (int)((uint8_t)(*s1)) - (int)((uint8_t)(*s2)); if (cdiff != 0) { return cdiff; } @@ -1498,7 +1498,7 @@ ssize_t mb_utf_index_to_bytes(const char *s, size_t len, size_t index, bool use_ /// two characters otherwise. int mb_strnicmp(const char *s1, const char *s2, const size_t nn) { - return utf_strnicmp((char_u *)s1, (char_u *)s2, nn, nn); + return utf_strnicmp(s1, s2, nn, nn); } /// Compare strings case-insensitively diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 0f2790b06c..51a4186775 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -351,7 +351,7 @@ int ml_open(buf_T *buf) dp->db_index[0] = --dp->db_txt_start; // at end of block dp->db_free -= 1 + (unsigned)INDEX_SIZE; dp->db_line_count = 1; - *((char_u *)dp + dp->db_txt_start) = NUL; // empty line + *((char *)dp + dp->db_txt_start) = NUL; // empty line return OK; @@ -1065,7 +1065,7 @@ void ml_recover(bool checkext) } // make sure there is a NUL at the end of the block - *((char_u *)dp + dp->db_txt_end - 1) = NUL; + *((char *)dp + dp->db_txt_end - 1) = NUL; // check number of lines in block // if wrong, use count in data block diff --git a/src/nvim/message.c b/src/nvim/message.c index 98ef6e5cba..b43bc6ce9b 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1589,7 +1589,7 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr) len -= mb_l - 1; str += mb_l; } else { - s = (char *)transchar_byte_buf(NULL, (uint8_t)(*str)); + s = transchar_byte_buf(NULL, (uint8_t)(*str)); if (s[1] != NUL) { // Unprintable char: print the printable chars so far and the // translation of the unprintable char. @@ -1671,7 +1671,7 @@ int msg_outtrans_special(const char *strstart, bool from, int maxlen) } if (text[0] != NUL && text[1] == NUL) { // single-byte character or illegal byte - text = (char *)transchar_byte_buf(NULL, (uint8_t)text[0]); + text = transchar_byte_buf(NULL, (uint8_t)text[0]); } const int len = vim_strsize(text); if (maxlen > 0 && retval + len >= maxlen) { @@ -1917,7 +1917,7 @@ void msg_prt_line(char *s, int list) s--; } else if (c != NUL && (n = byte2cells(c)) > 1) { n_extra = n - 1; - p_extra = (char *)transchar_byte_buf(NULL, c); + p_extra = transchar_byte_buf(NULL, c); c_extra = NUL; c_final = NUL; c = (unsigned char)(*p_extra++); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2edd1772ca..d66ed9abff 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5162,7 +5162,7 @@ void write_reg_contents_ex(int name, const char *str, ssize_t len, bool must_app /// @param str string or list of strings to put in register /// @param len length of the string (Ignored when str_list=true.) /// @param blocklen width of visual block, or -1 for "I don't know." -/// @param str_list True if str is `char_u **`. +/// @param str_list True if str is `char **`. static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char *str, size_t len, colnr_T blocklen, bool str_list) FUNC_ATTR_NONNULL_ALL diff --git a/src/nvim/option.c b/src/nvim/option.c index f672b3ab6f..8fa719c3a9 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -421,7 +421,7 @@ static void set_option_default(const int opt_idx, int opt_flags) // pointer to variable for current option vimoption_T *opt = &options[opt_idx]; - char_u *varp = (char_u *)get_varp_scope(opt, both ? OPT_LOCAL : opt_flags); + char *varp = get_varp_scope(opt, both ? OPT_LOCAL : opt_flags); uint32_t flags = opt->flags; if (varp != NULL) { // skip hidden option, nothing to do for it if (flags & P_STRING) { @@ -833,7 +833,7 @@ static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, co if (op == OP_REMOVING) { value = *(long *)varp - value; } - *errmsg = set_num_option(opt_idx, (char_u *)varp, (long)value, + *errmsg = set_num_option(opt_idx, (char *)varp, (long)value, errbuf, errbuflen, opt_flags); } @@ -847,7 +847,7 @@ static void munge_string_opt_val(char **varp, char **oldval, char **const origva if (varp == &p_kp && (**argp == NUL || **argp == ' ')) { *save_argp = *argp; *argp = ":help"; - } else if (varp == &p_bs && ascii_isdigit(**(char_u **)varp)) { + } else if (varp == &p_bs && ascii_isdigit((uint8_t)(**varp))) { // Convert 'backspace' number to string, for // adding, prepending and removing string. const int i = getdigits_int(varp, true, 0); @@ -927,7 +927,7 @@ static void do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, // reset, use the global value here. if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 && ((int)options[opt_idx].indir & PV_BOTH)) { - varp = (char *)options[opt_idx].var; + varp = options[opt_idx].var; } // The old value is kept until we are sure that the new value is valid. @@ -1439,7 +1439,7 @@ static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errb showoneopt(&options[opt_idx], opt_flags); if (p_verbose > 0) { // Mention where the option was last set. - if (varp == (char *)options[opt_idx].var) { + if (varp == options[opt_idx].var) { option_last_set_msg(options[opt_idx].last_set); } else if ((int)options[opt_idx].indir & PV_WIN) { option_last_set_msg(curwin->w_p_script_ctx[(int)options[opt_idx].indir & PV_MASK]); @@ -1735,7 +1735,7 @@ static char *option_expand(int opt_idx, char *val) // For 'spellsuggest' expand after "file:". expand_env_esc(val, NameBuff, MAXPATHL, (char **)options[opt_idx].var == &p_tags, false, - (char_u **)options[opt_idx].var == (char_u **)&p_sps ? "file:" : + (char **)options[opt_idx].var == &p_sps ? "file:" : NULL); if (strcmp(NameBuff, val) == 0) { // they are the same return NULL; @@ -2274,7 +2274,7 @@ static char *set_bool_option(const int opt_idx, char *const varp, const int valu /// @param[in] opt_flags OPT_LOCAL, OPT_GLOBAL or OPT_MODELINE. /// /// @return NULL on success, error message on error. -static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, +static char *set_num_option(int opt_idx, char *varp, long value, char *errbuf, size_t errbuflen, int opt_flags) { char *errmsg = NULL; @@ -2905,7 +2905,7 @@ getoption_T get_option_value(const char *name, long *numval, char **stringval, u return gov_unknown; } - char_u *varp = (char_u *)get_varp_scope(&(options[opt_idx]), scope); |