aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Göc <gocdundar@gmail.com>2022-08-26 23:11:25 +0200
committerDundar Göc <gocdundar@gmail.com>2022-08-27 17:59:43 +0200
commit691f4715c0cf4bc11ea2280db8777e6dd174a8ac (patch)
tree5fbd18d7d350d0df98cae0f620bafc2fd94006e7
parent09c6ce8c4e4c6415cca9b834539ed0df461373f6 (diff)
downloadrneovim-691f4715c0cf4bc11ea2280db8777e6dd174a8ac.tar.gz
rneovim-691f4715c0cf4bc11ea2280db8777e6dd174a8ac.tar.bz2
rneovim-691f4715c0cf4bc11ea2280db8777e6dd174a8ac.zip
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/charset.c2
-rw-r--r--src/nvim/cmdexpand.c2
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--src/nvim/diff.c2
-rw-r--r--src/nvim/edit.c6
-rw-r--r--src/nvim/eval/funcs.c6
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/ex_docmd.c16
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/file_search.c12
-rw-r--r--src/nvim/fileio.c12
-rw-r--r--src/nvim/garray.h2
-rw-r--r--src/nvim/getchar.c4
-rw-r--r--src/nvim/globals.h16
-rw-r--r--src/nvim/help.c2
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/indent.c13
-rw-r--r--src/nvim/insexpand.c29
-rw-r--r--src/nvim/lua/stdlib.c4
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/mark.c4
-rw-r--r--src/nvim/mbyte.c22
-rw-r--r--src/nvim/memfile.c10
-rw-r--r--src/nvim/memline.c20
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/normal.c4
-rw-r--r--src/nvim/normal.h4
-rw-r--r--src/nvim/ops.c12
-rw-r--r--src/nvim/option.c264
-rw-r--r--src/nvim/option_defs.h86
-rw-r--r--src/nvim/optionstr.c230
-rw-r--r--src/nvim/quickfix.c8
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/screen.c30
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/spell.c12
-rw-r--r--src/nvim/spellfile.c42
-rw-r--r--src/nvim/statusline.c4
-rw-r--r--src/nvim/syntax.c65
-rw-r--r--src/nvim/tag.c52
41 files changed, 497 insertions, 520 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 514be4c56b..5dc7083a01 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2701,7 +2701,7 @@ void buflist_list(exarg_T *eap)
home_replace(buf, buf->b_fname, (char *)NameBuff, MAXPATHL, true);
}
- if (message_filtered(NameBuff)) {
+ if (message_filtered((char_u *)NameBuff)) {
continue;
}
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index dc62b85716..df951854e0 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -246,7 +246,7 @@ int buf_init_chartab(buf_T *buf, int global)
}
c = *p;
- p = skip_to_option_part(p);
+ p = (char_u *)skip_to_option_part((char *)p);
if ((c == ',') && (*p == NUL)) {
// Trailing comma is not allowed.
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index b55e885235..7f9a8b2a5c 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -705,7 +705,7 @@ int showmatches(expand_T *xp, int wildmenu)
p = (char_u *)L_SHOWFILE(k);
} else {
home_replace(NULL, files_found[k], (char *)NameBuff, MAXPATHL, true);
- p = NameBuff;
+ p = (char_u *)NameBuff;
}
} else {
j = false;
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index d2f4910e14..9aee023f0c 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -703,7 +703,7 @@ void ex_breaklist(exarg_T *eap)
smsg(_("%3d %s %s line %" PRId64),
bp->dbg_nr,
bp->dbg_type == DBG_FUNC ? "func" : "file",
- bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff,
+ bp->dbg_type == DBG_FUNC ? bp->dbg_name : (char_u *)NameBuff,
(int64_t)bp->dbg_lnum);
} else {
smsg(_("%3d expr %s"), bp->dbg_nr, bp->dbg_name);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 8107b64c83..23fdc728f3 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1148,7 +1148,7 @@ static int diff_file(diffio_T *dio)
(diff_flags & DIFF_IBLANK) ? "-B " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
tmp_orig, tmp_new);
- append_redir(cmd, len, (char *)p_srr, tmp_diff);
+ append_redir(cmd, len, p_srr, tmp_diff);
block_autocmds(); // Avoid ShellCmdPost stuff
(void)call_shell((char_u *)cmd,
kShellOptFilter | kShellOptSilent | kShellOptDoOut,
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index ed625e1d6e..adcf9cd075 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -3282,10 +3282,8 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
}
}
- /*
- * Skip over ", ".
- */
- look = skip_to_option_part(look);
+ // Skip over ", ".
+ look = (char_u *)skip_to_option_part((char *)look);
}
return false;
}
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 581f187140..22447b933a 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -3895,9 +3895,11 @@ static void f_iconv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const char *const str = tv_get_string(&argvars[0]);
char buf1[NUMBUFLEN];
- char_u *const from = enc_canonize(enc_skip((char_u *)tv_get_string_buf(&argvars[1], buf1)));
+ char_u *const from =
+ (char_u *)enc_canonize((char *)enc_skip((char_u *)tv_get_string_buf(&argvars[1], buf1)));
char buf2[NUMBUFLEN];
- char_u *const to = enc_canonize(enc_skip((char_u *)tv_get_string_buf(&argvars[2], buf2)));
+ char_u *const to =
+ (char_u *)enc_canonize((char *)enc_skip((char_u *)tv_get_string_buf(&argvars[2], buf2)));
vimconv.vc_type = CONV_NONE;
convert_setup(&vimconv, from, to);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index a72cddc0a9..4a1cdb0fc5 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -743,7 +743,7 @@ void ex_retab(exarg_T *eap)
curwin->w_p_list = 0; // don't want list mode here
new_ts_str = eap->arg;
- if (!tabstop_set((char_u *)eap->arg, &new_vts_array)) {
+ if (!tabstop_set(eap->arg, &new_vts_array)) {
return;
}
while (ascii_isdigit(*(eap->arg)) || *(eap->arg) == ',') {
@@ -1656,7 +1656,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
}
#endif
if (otmp != NULL) {
- append_redir(buf, len, (char *)p_srr, otmp);
+ append_redir(buf, len, p_srr, otmp);
}
return buf;
}
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index eadde7a725..8ecc1e266b 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -531,7 +531,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
if (flags & DOCMD_KEEPLINE) {
xfree(repeat_cmdline);
if (count == 0) {
- repeat_cmdline = vim_strsave((char_u *)next_cmdline);
+ repeat_cmdline = (char *)vim_strsave((char_u *)next_cmdline);
} else {
repeat_cmdline = NULL;
}
@@ -3788,8 +3788,8 @@ int expand_filename(exarg_T *eap, char **cmdlinep, char **errormsgp)
// if there are still wildcards present.
if (vim_strchr(eap->arg, '$') != NULL
|| vim_strchr(eap->arg, '~') != NULL) {
- expand_env_esc((char_u *)eap->arg, NameBuff, MAXPATHL, true, true, NULL);
- has_wildcards = path_has_wildcard(NameBuff);
+ expand_env_esc((char_u *)eap->arg, (char_u *)NameBuff, MAXPATHL, true, true, NULL);
+ has_wildcards = path_has_wildcard((char_u *)NameBuff);
p = (char *)NameBuff;
} else {
p = NULL;
@@ -4058,7 +4058,7 @@ static int getargopt(exarg_T *eap)
*arg = NUL;
if (pp == &eap->force_ff) {
- if (check_ff_value((char_u *)eap->cmd + eap->force_ff) == FAIL) {
+ if (check_ff_value(eap->cmd + eap->force_ff) == FAIL) {
return FAIL;
}
eap->force_ff = (char_u)eap->cmd[eap->force_ff];
@@ -5482,8 +5482,8 @@ bool changedir_func(char *new_dir, CdScope scope)
new_dir = pdir;
}
- if (os_dirname(NameBuff, MAXPATHL) == OK) {
- pdir = (char *)vim_strsave(NameBuff);
+ if (os_dirname((char_u *)NameBuff, MAXPATHL) == OK) {
+ pdir = xstrdup(NameBuff);
} else {
pdir = NULL;
}
@@ -5496,7 +5496,7 @@ bool changedir_func(char *new_dir, CdScope scope)
if (*new_dir == NUL && p_cdh) {
#endif
// Use NameBuff for home directory name.
- expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
+ expand_env((char_u *)"$HOME", (char_u *)NameBuff, MAXPATHL);
new_dir = (char *)NameBuff;
}
@@ -5565,7 +5565,7 @@ void ex_cd(exarg_T *eap)
/// ":pwd".
static void ex_pwd(exarg_T *eap)
{
- if (os_dirname(NameBuff, MAXPATHL) == OK) {
+ if (os_dirname((char_u *)NameBuff, MAXPATHL) == OK) {
#ifdef BACKSLASH_IN_FILENAME
slash_adjust(NameBuff);
#endif
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 081aa80778..c509205a6c 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -854,7 +854,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
s->histype == HIST_SEARCH ? s->firstc : NUL);
if (s->firstc == ':') {
xfree(new_last_cmdline);
- new_last_cmdline = vim_strsave(ccline.cmdbuff);
+ new_last_cmdline = (char *)vim_strsave(ccline.cmdbuff);
}
}
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 273fe12d31..a990043017 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -1409,11 +1409,11 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
// copy file name into NameBuff, expanding environment variables
save_char = ptr[len];
ptr[len] = NUL;
- expand_env_esc(ptr, NameBuff, MAXPATHL, false, true, NULL);
+ expand_env_esc(ptr, (char_u *)NameBuff, MAXPATHL, false, true, NULL);
ptr[len] = save_char;
xfree(ff_file_to_find);
- ff_file_to_find = vim_strsave(NameBuff);
+ ff_file_to_find = vim_strsave((char_u *)NameBuff);
if (options & FNAME_UNESC) {
// Change all "\ " to " ".
for (ptr = ff_file_to_find; *ptr != NUL; ptr++) {
@@ -1473,11 +1473,11 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
buf = (char *)suffixes;
for (;;) {
if (
- (os_path_exists(NameBuff)
+ (os_path_exists((char_u *)NameBuff)
&& (find_what == FINDFILE_BOTH
|| ((find_what == FINDFILE_DIR)
- == os_isdir(NameBuff))))) {
- file_name = vim_strsave(NameBuff);
+ == os_isdir((char_u *)NameBuff))))) {
+ file_name = vim_strsave((char_u *)NameBuff);
goto theend;
}
if (*buf == NUL) {
@@ -1641,7 +1641,7 @@ int vim_chdirfile(char *fname, CdCause cause)
STRLCPY(dir, fname, MAXPATHL);
*path_tail_with_sep(dir) = NUL;
- if (os_dirname(NameBuff, sizeof(NameBuff)) != OK) {
+ if (os_dirname((char_u *)NameBuff, sizeof(NameBuff)) != OK) {
NameBuff[0] = NUL;
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 39b4eb4376..b873388473 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -699,7 +699,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
* Decide which 'encoding' to use or use first.
*/
if (eap != NULL && eap->force_enc != 0) {
- fenc = (char *)enc_canonize((char_u *)eap->cmd + eap->force_enc);
+ fenc = enc_canonize(eap->cmd + eap->force_enc);
fenc_alloced = true;
keep_dest_enc = true;
} else if (curbuf->b_p_bin) {
@@ -2056,8 +2056,8 @@ void set_file_options(int set_options, exarg_T *eap)
void set_forced_fenc(exarg_T *eap)
{
if (eap->force_enc != 0) {
- char_u *fenc = enc_canonize((char_u *)eap->cmd + eap->force_enc);
- set_string_option_direct("fenc", -1, (char *)fenc, OPT_FREE|OPT_LOCAL, 0);
+ char *fenc = enc_canonize(eap->cmd + eap->force_enc);
+ set_string_option_direct("fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0);
xfree(fenc);
}
}
@@ -2081,12 +2081,12 @@ static char_u *next_fenc(char **pp, bool *alloced)
}
p = (char_u *)vim_strchr((*pp), ',');
if (p == NULL) {
- r = enc_canonize((char_u *)(*pp));
+ r = (char_u *)enc_canonize(*pp);
*pp += STRLEN(*pp);
} else {
r = vim_strnsave((char_u *)(*pp), (size_t)(p - (char_u *)(*pp)));
*pp = (char *)p + 1;
- p = enc_canonize(r);
+ p = (char_u *)enc_canonize((char *)r);
xfree(r);
r = p;
}
@@ -3055,7 +3055,7 @@ nobackup:
// Check for forced 'fileencoding' from "++opt=val" argument.
if (eap != NULL && eap->force_enc != 0) {
fenc = eap->cmd + eap->force_enc;
- fenc = (char *)enc_canonize((char_u *)fenc);
+ fenc = enc_canonize(fenc);
fenc_tofree = fenc;
} else {
fenc = buf->b_p_fenc;
diff --git a/src/nvim/garray.h b/src/nvim/garray.h
index 56bd5c9130..0281678925 100644
--- a/src/nvim/garray.h
+++ b/src/nvim/garray.h
@@ -4,7 +4,7 @@
#include <stddef.h> // for size_t
#include "nvim/log.h"
-#include "nvim/types.h" // for char_u
+#include "nvim/types.h"
/// Structure used for growing arrays.
/// This is used to store information that only grows, is deleted all at
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index c1c5680cb0..ebea4b7a9b 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1302,7 +1302,7 @@ void openscript(char_u *name, bool directly)
curscript++;
}
// use NameBuff for expanded name
- expand_env(name, NameBuff, MAXPATHL);
+ expand_env(name, (char_u *)NameBuff, MAXPATHL);
int error;
if ((scriptin[curscript] = file_open_new(&error, (char *)NameBuff,
kFileReadOnly, 0)) == NULL) {
@@ -2120,7 +2120,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// Check for match with 'pastetoggle'
if (*p_pt != NUL && mp == NULL && (State & (MODE_INSERT | MODE_NORMAL))) {
- bool match = typebuf_match_len(p_pt, &mlen);
+ bool match = typebuf_match_len((char_u *)p_pt, &mlen);
if (match) {
// write chars to script file(s)
if (mlen > typebuf.tb_maplen) {
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 7b93fbc852..8d62674a22 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -159,10 +159,10 @@ EXTERN colnr_T dollar_vcol INIT(= -1);
// Variables for Insert mode completion.
-EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode
-EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode
-EXTERN char_u *edit_submode_extra INIT(= NULL); // appended to edit_submode
-EXTERN hlf_T edit_submode_highl; // highl. method for extra info
+EXTERN char *edit_submode INIT(= NULL); // msg for CTRL-X submode
+EXTERN char *edit_submode_pre INIT(= NULL); // prepended to edit_submode
+EXTERN char *edit_submode_extra INIT(= NULL); // appended to edit_submode
+EXTERN hlf_T edit_submode_highl; // highl. method for extra info
// state for putting characters in the message area
EXTERN int cmdmsg_rl INIT(= false); // cmdline is drawn right to left
@@ -667,7 +667,7 @@ EXTERN int swap_exists_action INIT(= SEA_NONE); ///< For dialog when swap file
EXTERN bool swap_exists_did_quit INIT(= false); ///< Selected "quit" at the dialog.
EXTERN char_u IObuff[IOSIZE]; ///< Buffer for sprintf, I/O, etc.
-EXTERN char_u NameBuff[MAXPATHL]; ///< Buffer for expanding file names
+EXTERN char NameBuff[MAXPATHL]; ///< Buffer for expanding file names
EXTERN char msg_buf[MSG_BUF_LEN]; ///< Small buffer for messages
EXTERN char os_buf[ ///< Buffer for the os/ layer
#if MAXPATHL > IOSIZE
@@ -731,9 +731,9 @@ EXTERN bool need_start_insertmode INIT(= false); ///< start insert mode soon
// including the terminating NUL
EXTERN char last_mode[MODE_MAX_LENGTH] INIT(= "n");
-EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":)
-EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "."
-EXTERN char_u *new_last_cmdline INIT(= NULL); // new value for last_cmdline
+EXTERN char *last_cmdline INIT(= NULL); // last command line (for ":)
+EXTERN char *repeat_cmdline INIT(= NULL); // command line for "."
+EXTERN char *new_last_cmdline INIT(= NULL); // new value for last_cmdline
EXTERN char *autocmd_fname INIT(= NULL); // fname for <afile> on cmdline
EXTERN int autocmd_bufnr INIT(= 0); // fnum for <abuf> on cmdline
EXTERN char *autocmd_match INIT(= NULL); // name for <amatch> on cmdline
diff --git a/src/nvim/help.c b/src/nvim/help.c
index 19bf67c890..4b2b113437 100644
--- a/src/nvim/help.c
+++ b/src/nvim/help.c
@@ -537,7 +537,7 @@ int find_help_tags(const char *arg, int *num_matches, char ***matches, bool keep
if (keep_lang) {
flags |= TAG_KEEP_LANG;
}
- if (find_tags(IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK
+ if (find_tags((char *)IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK
&& *num_matches > 0) {
// Sort the matches found on the heuristic number that is after the
// tag name.
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index c5a84c731d..3e3d03fa9c 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -729,7 +729,7 @@ static int hl_cterm2rgb_color(int nr)
0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76,
0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE
};
- static char_u ansi_table[16][4] = {
+ static uint8_t ansi_table[16][4] = {
// R G B idx
{ 0, 0, 0, 1 }, // black
{ 224, 0, 0, 2 }, // dark red
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index c4805283c2..7c5f291837 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -34,12 +34,13 @@
/// Set the integer values corresponding to the string setting of 'vartabstop'.
/// "array" will be set, caller must free it if needed.
-/// Return false for an error.
-bool tabstop_set(char_u *var, long **array)
+///
+/// @return false for an error.
+bool tabstop_set(char *var, long **array)
{
long valcount = 1;
int t;
- char_u *cp;
+ char *cp;
if (var[0] == NUL || (var[0] == '0' && var[1] == NUL)) {
*array = NULL;
@@ -50,8 +51,8 @@ bool tabstop_set(char_u *var, long **array)
if (cp == var || cp[-1] == ',') {
char *end;
- if (strtol((char *)cp, &end, 10) <= 0) {
- if (cp != (char_u *)end) {
+ if (strtol(cp, &end, 10) <= 0) {
+ if (cp != end) {
emsg(_(e_positive));
} else {
semsg(_(e_invarg2), cp);
@@ -76,7 +77,7 @@ bool tabstop_set(char_u *var, long **array)
t = 1;
for (cp = var; *cp != NUL;) {
- int n = atoi((char *)cp);
+ int n = atoi(cp);
// Catch negative values, overflow and ridiculous big values.
if (n <= 0 || n > TABSTOP_MAX) {
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index e6c13f315e..981a8d42a6 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -268,7 +268,7 @@ void ins_ctrl_x(void)
}
// We're not sure which CTRL-X mode it will be yet
ctrl_x_mode = CTRL_X_NOT_DEFINED_YET;
- edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
+ edit_submode = _(CTRL_X_MSG(ctrl_x_mode));
edit_submode_pre = NULL;
showmode();
} else {
@@ -1830,9 +1830,9 @@ static bool set_ctrl_x_mode(const int c)
// scroll the window one line up or down
ctrl_x_mode = CTRL_X_SCROLL;
if (!(State & REPLACE_FLAG)) {
- edit_submode = (char_u *)_(" (insert) Scroll (^E/^Y)");
+ edit_submode = _(" (insert) Scroll (^E/^Y)");
} else {
- edit_submode = (char_u *)_(" (replace) Scroll (^E/^Y)");
+ edit_submode = _(" (replace) Scroll (^E/^Y)");
}
edit_submode_pre = NULL;
showmode();
@@ -2845,10 +2845,10 @@ static void get_next_tag_completion(void)
g_tag_at_cursor = true;
char **matches;
int num_matches;
- if (find_tags((char_u *)compl_pattern, &num_matches, &matches,
+ if (find_tags(compl_pattern, &num_matches, &matches,
TAG_REGEXP | TAG_NAMES | TAG_NOIC | TAG_INS_COMP
| (ctrl_x_mode_not_default() ? TAG_VERBOSE : 0),
- TAG_MANY, (char_u *)curbuf->b_ffname) == OK && num_matches > 0) {
+ TAG_MANY, curbuf->b_ffname) == OK && num_matches > 0) {
ins_compl_add_matches(num_matches, matches, p_ic);
}
g_tag_at_cursor = false;
@@ -4078,7 +4078,7 @@ static int ins_compl_start(void)
}
if (compl_status_adding()) {
- edit_submode_pre = (char_u *)_(" Adding");
+ edit_submode_pre = _(" Adding");
if (ctrl_x_mode_line_or_eval()) {
// Insert a new line, keep indentation but ignore 'comments'.
char *old = curbuf->b_p_com;
@@ -4097,9 +4097,9 @@ static int ins_compl_start(void)
}
if (compl_cont_status & CONT_LOCAL) {
- edit_submode = (char_u *)_(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
+ edit_submode = _(ctrl_x_msgs[CTRL_X_LOCAL_MSG]);
} else {
- edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
+ edit_submode = _(CTRL_X_MSG(ctrl_x_mode));
}
// If any of the original typed text has been changed we need to fix
@@ -4123,7 +4123,7 @@ static int ins_compl_start(void)
// showmode might reset the internal line pointers, so it must
// be called before line = ml_get(), or when this address is no
// longer needed. -- Acevedo.
- edit_submode_extra = (char_u *)_("-- Searching...");
+ edit_submode_extra = _("-- Searching...");
edit_submode_highl = HLF_COUNT;
showmode();
edit_submode_extra = NULL;
@@ -4137,20 +4137,19 @@ static void ins_compl_show_statusmsg(void)
{
// we found no match if the list has only the "compl_orig_text"-entry
if (is_first_match(compl_first_match->cp_next)) {
- edit_submode_extra = compl_status_adding() && compl_length > 1
- ? (char_u *)_(e_hitend) : (char_u *)_(e_patnotf);
+ edit_submode_extra = compl_status_adding() && compl_length > 1 ? _(e_hitend) : _(e_patnotf);
edit_submode_highl = HLF_E;
}
if (edit_submode_extra == NULL) {
if (match_at_original_text(compl_curr_match)) {
- edit_submode_extra = (char_u *)_("Back at original");
+ edit_submode_extra = _("Back at original");
edit_submode_highl = HLF_W;
} else if (compl_cont_status & CONT_S_IPOS) {
- edit_submode_extra = (char_u *)_("Word from other line");
+ edit_submode_extra = _("Word from other line");
edit_submode_highl = HLF_COUNT;
} else if (compl_curr_match->cp_next == compl_curr_match->cp_prev) {
- edit_submode_extra = (char_u *)_("The only match");
+ edit_submode_extra = _("The only match");
edit_submode_highl = HLF_COUNT;
compl_curr_match->cp_number = 1;
} else {
@@ -4175,7 +4174,7 @@ static void ins_compl_show_statusmsg(void)
_("match %d"),
compl_curr_match->cp_number);
}
- edit_submode_extra = match_ref;
+ edit_submode_extra = (char *)match_ref;
edit_submode_highl = HLF_R;
if (dollar_vcol >= 0) {
curs_columns(curwin, false);
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 64e9abe0c9..0d08817285 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -494,8 +494,8 @@ static int nlua_iconv(lua_State *lstate)
size_t str_len = 0;
const char *str = lua_tolstring(lstate, 1, &str_len);
- char_u *from = enc_canonize(enc_skip((char_u *)lua_tolstring(lstate, 2, NULL)));
- char_u *to = enc_canonize(enc_skip((char_u *)lua_tolstring(lstate, 3, NULL)));
+ char_u *from = (char_u *)enc_canonize((char *)enc_skip((char_u *)lua_tolstring(lstate, 2, NULL)));
+ char_u *to = (char_u *)enc_canonize((char *)enc_skip((char_u *)lua_tolstring(lstate, 3, NULL)));
vimconv_T vimconv;
vimconv.vc_type = CONV_NONE;
diff --git a/src/nvim/main.c b/src/nvim/main.c
index e2e150a892..09a387262c 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1490,7 +1490,7 @@ static void handle_quickfix(mparm_T *paramp)
set_string_option_direct("ef", -1, paramp->use_ef, OPT_FREE, SID_CARG);
}
vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef);
- if (qf_init(NULL, (char *)p_ef, p_efm, true, (char *)IObuff, (char *)p_menc) < 0) {
+ if (qf_init(NULL, (char *)p_ef, p_efm, true, (char *)IObuff, p_menc) < 0) {
msg_putchar('\n');
os_exit(3);
}
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index c4b30ae600..883371c5fb 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -674,7 +674,7 @@ static void fname2fnum(xfmark_T *fm)
)) {
int len;
- expand_env((char_u *)"~/", NameBuff, MAXPATHL);
+ expand_env((char_u *)"~/", (char_u *)NameBuff, MAXPATHL);
len = (int)STRLEN(NameBuff);
STRLCPY(NameBuff + len, fm->fname + 2, MAXPATHL - len);
} else {
@@ -683,7 +683,7 @@ static void fname2fnum(xfmark_T *fm)
// Try to shorten the file name.
os_dirname(IObuff, IOSIZE);
- p = path_shorten_fname(NameBuff, IObuff);
+ p = path_shorten_fname((char_u *)NameBuff, IObuff);
// buflist_new() will call fmarks_check_names()
(void)buflist_new((char *)NameBuff, (char *)p, (linenr_T)1, 0);
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 9213457608..dab6c8fbd3 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -2160,27 +2160,27 @@ char_u *enc_skip(char_u *p)
return p;
}
-/*
- * Find the canonical name for encoding "enc".
- * When the name isn't recognized, returns "enc" itself, but with all lower
- * case characters and '_' replaced with '-'.
- * Returns an allocated string.
- */
-char_u *enc_canonize(char_u *enc) FUNC_ATTR_NONNULL_RET
+/// Find the canonical name for encoding "enc".
+/// When the name isn't recognized, returns "enc" itself, but with all lower
+/// case characters and '_' replaced with '-'.
+///
+/// @return an allocated string.
+char *enc_canonize(char *enc)
+ FUNC_ATTR_NONNULL_RET
{
char_u *p, *s;
int i;
if (STRCMP(enc, "default") == 0) {
// Use the default encoding as found by set_init_1().
- return vim_strsave(fenc_default);
+ return (char *)vim_strsave(fenc_default);
}
// copy "enc" to allocated memory, with room for two '-'
char_u *r = xmalloc(STRLEN(enc) + 3);
// Make it all lower case and replace '_' with '-'.
p = r;
- for (s = enc; *s != NUL; s++) {
+ for (s = (char_u *)enc; *s != NUL; s++) {
if (*s == '_') {
*p++ = '-';
} else {
@@ -2224,7 +2224,7 @@ char_u *enc_canonize(char_u *enc) FUNC_ATTR_NONNULL_RET
xfree(r);
r = vim_strsave((char_u *)enc_canon_table[i].name);
}
- return r;
+ return (char *)r;
}
/// Search for an encoding alias of "name".
@@ -2309,7 +2309,7 @@ enc_locale_copy_enc:
buf[i] = NUL;
}
- return enc_canonize((char_u *)buf);
+ return (char_u *)enc_canonize(buf);
}
#if defined(HAVE_ICONV)
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 216ee26620..9446aaee4f 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -77,7 +77,7 @@
///
/// @return - The open memory file, on success.
/// - NULL, on failure (e.g. file does not exist).
-memfile_T *mf_open(char_u *fname, int flags)
+memfile_T *mf_open(char *fname, int flags)
{
memfile_T *mfp = xmalloc(sizeof(memfile_T));
@@ -148,7 +148,7 @@ memfile_T *mf_open(char_u *fname, int flags)
///
/// @return OK On success.
/// FAIL If file could not be opened.
-int mf_open_file(memfile_T *mfp, char_u *fname)
+int mf_open_file(memfile_T *mfp, char *fname)
{
if (mf_do_open(mfp, fname, O_RDWR | O_CREAT | O_EXCL)) {
mfp->mf_dirty = true;
@@ -749,9 +749,9 @@ void mf_free_fnames(memfile_T *mfp)
///
/// Only called when creating or renaming the swapfile. Either way it's a new
/// name so we must work out the full path name.
-void mf_set_fnames(memfile_T *mfp, char_u *fname)
+void mf_set_fnames(memfile_T *mfp, char *fname)
{
- mfp->mf_fname = fname;
+ mfp->mf_fname = (char_u *)fname;
mfp->mf_ffname = (char_u *)FullName_save((char *)mfp->mf_fname, false);
}
@@ -779,7 +779,7 @@ bool mf_need_trans(memfile_T *mfp)
///
/// @param flags Flags for open().
/// @return A bool indicating success of the `open` call.
-static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
+static bool mf_do_open(memfile_T *mfp, char *fname, int flags)
{
// fname cannot be NameBuff, because it must have been allocated.
mf_set_fnames(mfp, fname);
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 2913d0d271..ee90ae6b15 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -430,7 +430,7 @@ void ml_setname(buf_T *buf)
if (vim_rename(mfp->mf_fname, fname) == 0) {
success = true;
mf_free_fnames(mfp);
- mf_set_fnames(mfp, fname);
+ mf_set_fnames(mfp, (char *)fname);
ml_upd_block0(buf, UB_SAME_DIR);
break;
}
@@ -483,7 +483,7 @@ void ml_open_file(buf_T *buf)
if (buf->b_spell) {
fname = vim_tempname();
if (fname != NULL) {
- (void)mf_open_file(mfp, fname); // consumes fname!
+ (void)mf_open_file(mfp, (char *)fname); // consumes fname!
}
buf->b_may_swap = false;
return;
@@ -506,7 +506,7 @@ void ml_open_file(buf_T *buf)
if (fname == NULL) {
continue;
}
- if (mf_open_file(mfp, fname) == OK) { // consumes fname!
+ if (mf_open_file(mfp, (char *)fname) == OK) { // consumes fname!
ml_upd_block0(buf, UB_SAME_DIR);
// Flush block zero, so others can read it
@@ -835,7 +835,7 @@ void ml_recover(bool checkext)
*/
p = vim_strsave(fname_used); // save "fname_used" for the message:
// mf_open() will consume "fname_used"!
- mfp = mf_open(fname_used, O_RDONLY);
+ mfp = mf_open((char *)fname_used, O_RDONLY);
fname_used = p;
if (mfp == NULL || mfp->mf_fd < 0) {
semsg(_("E306: Cannot open %s"), fname_used);
@@ -926,7 +926,7 @@ void ml_recover(bool checkext)
* If .swp file name given directly, use name from swap file for buffer.
*/
if (directly) {
- expand_env(b0p->b0_fname, NameBuff, MAXPATHL);
+ expand_env(b0p->b0_fname, (char_u *)NameBuff, MAXPATHL);
if (setfname(curbuf, (char *)NameBuff, NULL, true) == FAIL) {
goto theend;
}
@@ -1873,7 +1873,7 @@ errorret:
// when the GUI redraws part of the text.
recursive++;
get_trans_bufname(buf);
- shorten_dir(NameBuff);
+ shorten_dir((char_u *)NameBuff);
siemsg(_("E316: ml_get: cannot find line %" PRId64 " in buffer %d %s"),
(int64_t)lnum, buf->b_fnum, NameBuff);
recursive--;
@@ -3472,8 +3472,8 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// Symlinks may point to the same file even
// when the name differs, need to check the
// inode too.
- expand_env(b0.b0_fname, NameBuff, MAXPATHL);
- if (fnamecmp_ino((char_u *)buf->b_ffname, NameBuff,
+ expand_env(b0.b0_fname, (char_u *)NameBuff, MAXPATHL);
+ if (fnamecmp_ino((char_u *)buf->b_ffname, (char_u *)NameBuff,
char_to_long(b0.b0_ino))) {
differ = true;
}
@@ -3481,8 +3481,8 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
} else {
// The name in the swap file may be
// "~user/path/file". Expand it first.
- expand_env(b0.b0_fname, NameBuff, MAXPATHL);
- if (fnamecmp_ino((char_u *)buf->b_ffname, NameBuff,
+ expand_env(b0.b0_fname, (char_u *)NameBuff, MAXPATHL);
+ if (fnamecmp_ino((char_u *)buf->b_ffname, (char_u *)NameBuff,
char_to_long(b0.b0_ino))) {
differ = true;
}
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 40de8a2bc6..fbf9c9b603 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -3426,7 +3426,7 @@ int verbose_open(void)
// Only give the error message once.
verbose_did_open = true;
- verbose_fd = os_fopen((char *)p_vfile, "a");
+ verbose_fd = os_fopen(p_vfile, "a");
if (verbose_fd == NULL) {
semsg(_(e_notopen), p_vfile);
return FAIL;
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 31646f686d..5dd6742e2f 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -4807,14 +4807,14 @@ static void nv_search(cmdarg_T *cap)
// When using 'incsearch' the cursor may be moved to set a different search
// start position.
- cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, true);
+ cap->searchbuf = (char *)getcmdline(cap->cmdchar, cap->count1, 0, true);
if (cap->searchbuf == NULL) {
clearop(oap);
return;
}
- (void)normal_search(cap, cap->cmdchar, cap->searchbuf,
+ (void)normal_search(cap, cap->cmdchar, (char_u *)cap->searchbuf,
(cap->arg || !equalpos(save_cursor, curwin->w_cursor))
? 0 : SEARCH_MARK, NULL);
}
diff --git a/src/nvim/normal.h b/src/nvim/normal.h
index 9bda70eacd..13ea233658 100644
--- a/src/nvim/normal.h
+++ b/src/nvim/normal.h
@@ -57,7 +57,7 @@ typedef struct oparg_S {
* Arguments for Normal mode commands.
*/
typedef struct cmdarg_S {
- oparg_T *oap; // Operator arguments
+ oparg_T *oap; // Operator arguments
int prechar; // prefix character (optional, always 'g')
int cmdchar; // command character
int nchar; // next command character (optional)
@@ -69,7 +69,7 @@ typedef struct cmdarg_S {
long count1; // count before command, default 1
int arg; // extra argument from nv_cmds[]
int retval; // return: CA_* values
- char_u *searchbuf; // return: pointer to search pattern or NULL
+ char *searchbuf; // return: pointer to search pattern or NULL
} cmdarg_T;
// values for retval:
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 0fc15b9382..1bf4c00633 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1111,7 +1111,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
// don't keep the cmdline containing @:
XFREE_CLEAR(new_last_cmdline);
// Escape all control characters with a CTRL-V
- p = vim_strsave_escaped_ext(last_cmdline,
+ p = vim_strsave_escaped_ext((char_u *)last_cmdline,
(char_u *)"\001\002\003\004\005\006\007"
"\010\011\012\013\014\015\016\017"
"\020\021\022\023\024\025\026\027"
@@ -1346,7 +1346,7 @@ bool get_spec_reg(int regname, char **argp, bool *allocated, bool errmsg)
if (last_cmdline == NULL && errmsg) {
emsg(_(e_nolastcmd));
}
- *argp = (char *)last_cmdline;
+ *argp = last_cmdline;
return true;
case '/': // last search-pattern
@@ -3854,9 +3854,9 @@ void ex_display(exarg_T *eap)
// display last command line
if (last_cmdline != NULL && (arg == NULL || vim_strchr((char *)arg, ':') != NULL)
- && !got_int && !message_filtered(last_cmdline)) {
+ && !got_int && !message_filtered((char_u *)last_cmdline)) {
msg_puts("\n c \": ");
- dis_msg(last_cmdline, false);
+ dis_msg((char_u *)last_cmdline, false);
}
// display current file name
@@ -5799,7 +5799,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
// If 'cpoptions' does not contain 'r', insert the search
// pattern to really repeat the same command.
if (vim_strchr(p_cpo, CPO_REDO) == NULL) {
- AppendToRedobuffLit((char *)cap->searchbuf, -1);
+ AppendToRedobuffLit(cap->searchbuf, -1);
}
AppendToRedobuff(NL_STR);
} else if (cap->cmdchar == ':' || cap->cmdchar == K_COMMAND) {
@@ -5809,7 +5809,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (repeat_cmdline == NULL) {
ResetRedobuff();
} else {
- AppendToRedobuffLit((char *)repeat_cmdline, -1);
+ AppendToRedobuffLit(repeat_cmdline, -1);
AppendToRedobuff(NL_STR);
XFREE_CLEAR(repeat_cmdline);
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 4bf978d2f6..c3f803e543 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -149,7 +149,7 @@ static int p_et_nopaste;
static long p_sts_nopaste;
static long p_tw_nopaste;
static long p_wm_nopaste;
-static char_u *p_vsts_nopaste;
+static char *p_vsts_nopaste;
typedef struct vimoption {
char *fullname; // full option name
@@ -455,7 +455,7 @@ static void set_option_default(int opt_idx, int opt_flags)
char_u *varp; // pointer to variable for current option
int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
- varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
+ varp = (char_u *)get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags);
uint32_t flags = options[opt_idx].flags;
if (varp != NULL) { // skip hidden option, nothing to do for it
if (flags & P_STRING) {
@@ -675,12 +675,12 @@ void set_init_3(void)
if (FNAMECMP(p, "csh") == 0
|| FNAMECMP(p, "tcsh") == 0) {
if (do_sp) {
- p_sp = (char_u *)"|& tee";
- options[idx_sp].def_val = p_sp;
+ p_sp = "|& tee";
+ options[idx_sp].def_val = (char_u *)p_sp;
}
if (do_srr) {
- p_srr = (char_u *)">&";
- options[idx_srr].def_val = p_srr;
+ p_srr = ">&";
+ options[idx_srr].def_val = (char_u *)p_srr;
}
} else if (FNAMECMP(p, "sh") == 0
|| FNAMECMP(p, "ksh") == 0
@@ -694,12 +694,12 @@ void set_init_3(void)
|| FNAMECMP(p, "dash") == 0) {
// Always use POSIX shell style redirection if we reach this
if (do_sp) {
- p_sp = (char_u *)"2>&1| tee";
- options[idx_sp].def_val = p_sp;
+ p_sp = "2>&1| tee";
+ options[idx_sp].def_val = (char_u *)p_sp;
}
if (do_srr) {
- p_srr = (char_u *)">%s 2>&1";
- options[idx_srr].def_val = p_srr;
+ p_srr = ">%s 2>&1";
+ options[idx_srr].def_val = (char_u *)p_srr;
}
}
xfree(p);
@@ -810,7 +810,7 @@ int do_set(char *arg, int opt_flags)
int opt_idx;
char *errmsg;
char errbuf[80];
- char_u *startarg;
+ char *startarg;
int prefix; // 1: nothing, 0: "no", 2: "inv" in front of name
char_u nextchar; // next non-white char after option name
int afterchar; // character just after option name
@@ -833,7 +833,7 @@ int do_set(char *arg, int opt_flags)
while (*arg != NUL) { // loop to process all options
errmsg = NULL;
- startarg = (char_u *)arg; // remember for error message
+ startarg = arg; // remember for error message
if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
&& !(opt_flags & OPT_MODELINE)) {
@@ -947,7 +947,7 @@ int do_set(char *arg, int opt_flags)
}
flags = options[opt_idx].flags;
- varp = (char *)get_varp_scope(&(options[opt_idx]), opt_flags);
+ varp = get_varp_scope(&(options[opt_idx]), opt_flags);
} else {
flags = P_STRING;
}
@@ -1543,12 +1543,12 @@ skip:
if (errmsg != NULL) {
STRLCPY(IObuff, _(errmsg), IOSIZE);
i = (int)STRLEN(IObuff) + 2;
- if (i + ((char_u *)arg - startarg) < IOSIZE) {
+ if (i + (arg - startarg) < IOSIZE) {
// append the argument with the error
STRCAT(IObuff, ": ");
- assert((char_u *)arg >= startarg);
- memmove(IObuff + i, startarg, (size_t)((char_u *)arg - startarg));
- IObuff[i + ((char_u *)arg - startarg)] = NUL;
+ assert(arg >= startarg);
+ memmove(IObuff + i, startarg, (size_t)(arg - startarg));
+ IObuff[i + (arg - startarg)] = NUL;
}
// make sure all characters are printable
trans_characters((char *)IObuff, IOSIZE);
@@ -1741,7 +1741,7 @@ static char_u *option_expand(int opt_idx, char_u *val)
* names.
* For 'spellsuggest' expand after "file:".
*/
- expand_env_esc(val, NameBuff, MAXPATHL,
+ expand_env_esc(val, (char_u *)NameBuff, MAXPATHL,
(char_u **)options[opt_idx].var == &p_tags, false,
(char_u **)options[opt_idx].var == (char_u **)&p_sps ? (char_u *)"file:" :
NULL);
@@ -1749,7 +1749,7 @@ static char_u *option_expand(int opt_idx, char_u *val)
return NULL;
}
- return NameBuff;
+ return (char_u *)NameBuff;
}
/// After setting various option values: recompute variables that depend on
@@ -1779,17 +1779,17 @@ static void didset_options2(void)
highlight_changed();
// Parse default for 'fillchars'.
- (void)set_chars_option(curwin, (char_u **)&curwin->w_p_fcs, true);
+ (void)set_chars_option(curwin, &curwin->w_p_fcs, true);
// Parse default for 'listchars'.
- (void)set_chars_option(curwin, (char_u **)&curwin->w_p_lcs, true);
+ (void)set_chars_option(curwin, &curwin->w_p_lcs, true);
// Parse default for 'wildmode'.
check_opt_wim();
xfree(curbuf->b_p_vsts_array);
- (void)tabstop_set((char_u *)curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
+ (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
xfree(curbuf->b_p_vts_array);
- (void)tabstop_set((char_u *)curbuf->b_p_vts, &curbuf->b_p_vts_array);
+ (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);
}
/// Check for string options that are NULL (normally only termcap options).
@@ -1858,10 +1858,10 @@ void redraw_titles(void)
/// Return true if "val" is a valid name: only consists of alphanumeric ASCII
/// characters or characters in "allowed".
-bool valid_name(const char_u *val, const char *allowed)
+bool valid_name(const char *val, const char *allowed)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- for (const char_u *s = val; *s != NUL; s++) {
+ for (const char_u *s = (char_u *)val; *s != NUL; s++) {
if (!ASCII_ISALNUM(*s)
&& vim_strchr(allowed, *s) == NULL) {
return false;
@@ -2930,14 +2930,14 @@ getoption_T get_option_value(const char *name, long *numval, char **stringval, i
return gov_unknown;
}
- char_u *varp = get_varp_scope(&(options[opt_idx]), opt_flags);
+ char_u *varp = (char_u *)get_varp_scope(&(options[opt_idx]), opt_flags);
if (options[opt_idx].flags & P_STRING) {
if (varp == NULL) { // hidden option
return gov_hidden_string;
}
if (stringval != NULL) {
- if ((char_u **)varp == &p_pt) { // 'pastetoggle'
+ if ((char **)varp == &p_pt) { // 'pastetoggle'
*stringval = str2special_save(*(char **)(varp), false, false);
} else {
*stringval = xstrdup(*(char **)(varp));
@@ -3056,7 +3056,7 @@ int get_option_value_strict(char *name, int64_t *numval, char **stringval, int o
// only getting a pointer, no need to use aucmd_prepbuf()
curbuf = (buf_T *)from;
curwin->w_buffer = curbuf;
- varp = get_varp_scope(p, OPT_LOCAL);
+ varp = (char_u *)get_varp_scope(p, OPT_LOCAL);
curbuf = save_curbuf;
curwin->w_buffer = curbuf;
}
@@ -3064,7 +3064,7 @@ int get_option_value_strict(char *name, int64_t *numval, char **stringval, int o
win_T *save_curwin = curwin;
curwin = (win_T *)from;
curbuf = curwin->w_buffer;
- varp = get_varp_scope(p, OPT_LOCAL);
+ varp = (char_u *)get_varp_scope(p, OPT_LOCAL);
curwin = save_curwin;
curbuf = curwin->w_buffer;
}
@@ -3170,7 +3170,7 @@ char *set_option_value(const char *const name, const long number, const char *co
return set_string_option(opt_idx, s, opt_flags);
}
- varp = get_varp_scope(&(options[opt_idx]), opt_flags);
+ varp = (char_u *)get_varp_scope(&(options[opt_idx]), opt_flags);
if (varp != NULL) { // hidden option is not changed
if (number == 0 && string != NULL) {
int idx;
@@ -3306,7 +3306,7 @@ static void showoptions(int all, int opt_flags)
varp = NULL;
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) != 0) {
if (p->indir != PV_NONE) {
- varp = get_varp_scope(p, opt_flags);
+ varp = (char_u *)get_varp_scope(p, opt_flags);
}
} else {
varp = get_varp(p);
@@ -3410,13 +3410,12 @@ void ui_refresh_options(void)
/// @param opt_flags OPT_LOCAL or OPT_GLOBAL
static void showoneopt(vimoption_T *p, int opt_flags)
{
- char_u *varp;
int save_silent = silent_mode;
silent_mode = false;
info_message = true; // use mch_msg(), not mch_errmsg()
- varp = get_varp_scope(p, opt_flags);
+ char_u *varp = (char_u *)get_varp_scope(p, opt_flags);
// for 'modified' we also need to check if 'ff' or 'fenc' changed.
if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed
@@ -3462,7 +3461,7 @@ static void showoneopt(vimoption_T *p, int opt_flags)
int makeset(FILE *fd, int opt_flags, int local_only)
{
vimoption_T *p;
- char_u *varp; // currently used value
+ char *varp; // currently used value
char_u *varp_fresh; // local value
char_u *varp_local = NULL; // fresh value
char *cmd;
@@ -3499,7 +3498,7 @@ int makeset(FILE *fd, int opt_flags, int local_only)
continue;
}
// Global values are only written when not at the default value.
- if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp)) {
+ if ((opt_flags & OPT_GLOBAL) && optval_default(p, (char_u *)varp)) {
continue;
}
@@ -3518,11 +3517,11 @@ int makeset(FILE *fd, int opt_flags, int local_only)
// When fresh value of window-local option is not at the
// default, need to write it too.
if (!(opt_flags & OPT_GLOBAL) && !local_only) {
- varp_fresh = get_varp_scope(p, OPT_GLOBAL);
+ varp_fresh = (char_u *)get_varp_scope(p, OPT_GLOBAL);
if (!optval_default(p, varp_fresh)) {
round = 1;
- varp_local = varp;
- varp = varp_fresh;
+ varp_local = (char_u *)varp;
+ varp = (char *)varp_fresh;
}
}
}
@@ -3530,7 +3529,7 @@ int makeset(FILE *fd, int opt_flags, int local_only)
// Round 1: fresh value for window-local options.
// Round 2: other values
- for (; round <= 2; varp = varp_local, round++) {
+ for (; round <= 2; varp = (char *)varp_local, round++) {
if (round == 1 || (opt_flags & OPT_GLOBAL)) {
cmd = "set";
} else {
@@ -3558,8 +3557,7 @@ int makeset(FILE *fd, int opt_flags, int local_only)
}
do_endif = true;
}
- if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
- p->flags) == FAIL) {
+ if (put_setstring(fd, cmd, p->fullname, (char **)varp, p->flags) == FAIL) {
return FAIL;
}
if (do_endif) {
@@ -3579,25 +3577,21 @@ int makeset(FILE *fd, int opt_flags, int local_only)
/// 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
int makefoldset(FILE *fd)
{
- if (put_setstring(fd, "setlocal", "fdm", (char_u **)&curwin->w_p_fdm, 0) == FAIL
- || put_setstring(fd, "setlocal", "fde", (char_u **)&curwin->w_p_fde, 0)
- == FAIL
- || put_setstring(fd, "setlocal", "fmr", (char_u **)&curwin->w_p_fmr, 0)
- == FAIL
- || put_setstring(fd, "setlocal", "fdi", (char_u **)&curwin->w_p_fdi, 0)
- == FAIL
+ if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, 0) == FAIL
+ || put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, 0) == FAIL
+ || put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, 0) == FAIL
+ || put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, 0) == FAIL
|| put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
|| put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
|| put_setnum(fd, "setlocal", "fdn", &curwin->w_p_fdn) == FAIL
- || put_setbool(fd, "setlocal", "fen",
- curwin->w_p_fen) == FAIL) {
+ || put_setbool(fd, "setlocal", "fen", curwin->w_p_fen) == FAIL) {
return FAIL;
}
return OK;
}
-static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, uint64_t flags)
+static int put_setstring(FILE *fd, char *cmd, char *name, char **valuep, uint64_t flags)
{
char_u *s;
char_u *buf = NULL;
@@ -3612,7 +3606,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, uint6
// options some characters have to be escaped with
// CTRL-V or backslash
if (valuep == &p_pt) {
- s = *valuep;
+ s = (char_u *)(*valuep);
while (*s != NUL) {
if (put_escstr(fd, (char_u *)str2special((const char **)&s, false,
false), 2)
@@ -3625,13 +3619,13 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, uint6
// replace home directory in the whole option value into "buf"
buf = xmalloc(size);
- home_replace(NULL, (char *)(*valuep), (char *)buf, size, false);
+ home_replace(NULL, *valuep, (char *)buf, size, false);
// If the option value is longer than MAXPATHL, we need to append
// each comma separated part of the option separately, so that it
// can be expanded when read back.
if (size >= MAXPATHL && (flags & P_COMMA) != 0
- && vim_strchr((char *)(*valuep), ',') != NULL) {
+ && vim_strchr(*valuep, ',') != NULL) {
part = xmalloc(size);
// write line break to clear the option, e.g. ':set rtp='
@@ -3659,7 +3653,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, uint6
return FAIL;
}
xfree(buf);
- } else if (put_escstr(fd, *valuep, 2) == FAIL) {
+ } else if (put_escstr(fd, (char_u *)(*valuep), 2) == FAIL) {
return FAIL;
}
}
@@ -3798,12 +3792,12 @@ void unset_global_local_option(char *name, void *from)
break;
case PV_LCS:
clear_string_option(&((win_T *)from)->w_p_lcs);
- set_chars_option((win_T *)from, (char_u **)&((win_T *)from)->w_p_lcs, true);
+ set_chars_option((win_T *)from, &((win_T *)from)->w_p_lcs, true);
redraw_later((win_T *)from, UPD_NOT_VALID);
break;
case PV_FCS:
clear_string_option(&((win_T *)from)->w_p_fcs);
- set_chars_option((win_T *)from, (char_u **)&((win_T *)from)->w_p_fcs, true);
+ set_chars_option((win_T *)from, &((win_T *)from)->w_p_fcs, true);
redraw_later((win_T *)from, UPD_NOT_VALID);
break;
case PV_VE:
@@ -3814,81 +3808,81 @@ void unset_global_local_option(char *name, void *from)
}
/// Get pointer to option variable, depending on local or global scope.
-static char_u *get_varp_scope(vimoption_T *p, int opt_flags)
+static char *get_varp_scope(vimoption_T *p, int opt_flags)
{
if ((opt_flags & OPT_GLOBAL) && p->indir != PV_NONE) {
if (p->var == VAR_WIN) {
- return (char_u *)GLOBAL_WO(get_varp(p));
+ return GLOBAL_WO(get_varp(p));
}
- return p->var;
+ return (char *)p->var;
}
if ((opt_flags & OPT_LOCAL) && ((int)p->indir & PV_BOTH)) {
switch ((int)p->indir) {
case PV_FP:
- return (char_u *)&(curbuf->b_p_fp);
+ return (char *)&(curbuf->b_p_fp);
case PV_EFM:
- return (char_u *)&(curbuf->b_p_efm);
+ return (char *)&(curbuf->b_p_efm);
case PV_GP:
- return (char_u *)&(curbuf->b_p_gp);
+ return (char *)&(curbuf->b_p_gp);
case PV_MP:
- return (char_u *)&(curbuf->b_p_mp);
+ return (char *)&(curbuf->b_p_mp);
case PV_EP:
- return (char_u *)&(curbuf->b_p_ep);
+ return (char *)&(curbuf->b_p_ep);
case PV_KP:
- return (char_u *)&(curbuf->b_p_kp);
+ return (char *)&(curbuf->b_p_kp);
case PV_PATH:
- return (char_u *)&(curbuf->b_p_path);
+ return (char *)&(curbuf->b_p_path);
case PV_AR:
- return (char_u *)&(curbuf->b_p_ar);
+ return (char *)&(curbuf->b_p_ar);
case PV_TAGS:
- return (char_u *)&(curbuf->b_p_tags);
+ return (char *)&(curbuf->b_p_tags);
case PV_TC:
- return (char_u *)&(curbuf->b_p_tc);
+ return (char *)&(curbuf->b_p_tc);
case PV_SISO:
- return (char_u *)&(curwin->w_p_siso);
+ return (char *)&(curwin->w_p_siso);
case PV_SO:
- return (char_u *)&(curwin->w_p_so);
+ return (char *)&(curwin->w_p_so);
case PV_DEF:
- return (char_u *)&(curbuf->b_p_def);
+ return (char *)&(curbuf->b_p_def);
case PV_INC:
- return (char_u *)&(curbuf->b_p_inc);
+ return (char *)&(curbuf->b_p_inc);
case PV_DICT:
- return (char_u *)&(curbuf->b_p_dict);
+ return (char *)&(curbuf->b_p_dict);
case PV_TSR:
- return (char_u *)&(curbuf->b_p_tsr);
+ return (char *)&(curbuf->b_p_tsr);
case PV_TSRFU:
- return (char_u *)&(curbuf->b_p_tsrfu);
+ return (char *)&(curbuf->b_p_tsrfu);
case PV_TFU:
- return (char_u *)&(curbuf->b_p_tfu);
+ return (char *)&(curbuf->b_p_tfu);
case PV_SBR:
- return (char_u *)&(curwin->w_p_sbr);
+ return (char *)&(curwin->w_p_sbr);
case PV_STL:
- return (char_u *)&(curwin->w_p_stl);
+ return (char *)&(curwin->w_p_stl);
case PV_WBR:
- return (char_u *)&(curwin->w_p_wbr);
+ return (char *)&(curwin->w_p_wbr);
case PV_UL:
- return (char_u *)&(curbuf->b_p_ul);
+ return (char *)&(curbuf->b_p_ul);
case PV_LW:
- return (char_u *)&(curbuf->b_p_lw);
+ return (char *)&(curbuf->b_p_lw);
case PV_BKC:
- return (char_u *)&(curbuf->b_p_bkc);
+ return (char *)&(curbuf->b_p_bkc);
case PV_MENC:
- return (char_u *)&(curbuf->b_p_menc);
+ return (char *)&(curbuf->b_p_menc);
case PV_FCS:
- return (char_u *)&(curwin->w_p_fcs);
+ return (char *)&(curwin->w_p_fcs);
case PV_LCS:
- return (char_u *)&(curwin->w_p_lcs);
+ return (char *)&(curwin->w_p_lcs);
case PV_VE:
- return (char_u *)&(curwin->w_p_ve);
+ return (char *)&(curwin->w_p_ve);
}
return NULL; // "cannot happen"
}
- return get_varp(p);
+ return (char *)get_varp(p);
}
/// Get pointer to option variable at 'opt_idx', depending on local or global
/// scope.
-char_u *get_option_varp_scope(int opt_idx, int opt_flags)
+char *get_option_varp_scope(int opt_idx, int opt_flags)
{
return get_varp_scope(&(options[opt_idx]), opt_flags);
}
@@ -4365,8 +4359,8 @@ void didset_window_options(win_T *wp, bool valid_cursor)
check_colorcolumn(wp);
briopt_check(wp);
fill_culopt_flags(NULL, wp);
- set_chars_option(wp, (char_u **)&wp->w_p_fcs, true);
- set_chars_option(wp, (char_u **)&wp->w_p_lcs, true);
+ set_chars_option(wp, &wp->w_p_fcs, true);
+ set_chars_option(wp, &wp->w_p_lcs, true);
parse_winhl_opt(wp); // sets w_hl_needs_update also for w_p_winbl
check_blending(wp);
set_winbar_win(wp, false, valid_cursor);
@@ -4504,7 +4498,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_swf = p_swf;
COPY_OPT_SCTX(buf, BV_SWF);
}
- buf->b_p_cpt = (char *)vim_strsave(p_cpt);
+ buf->b_p_cpt = xstrdup(p_cpt);
COPY_OPT_SCTX(buf, BV_CPT);
#ifdef BACKSLASH_IN_FILENAME
buf->b_p_csl = vim_strsave(p_csl);
@@ -4514,32 +4508,30 @@ void buf_copy_options(buf_T *buf, int flags)
COPY_OPT_SCTX(buf, BV_CFU);
buf->b_p_ofu = xstrdup(p_ofu);
COPY_OPT_SCTX(buf, BV_OFU);
- buf->b_p_tfu = (char *)vim_strsave(p_tfu);
+ buf->b_p_tfu = xstrdup(p_tfu);
COPY_OPT_SCTX(buf, BV_TFU);
buf->b_p_sts = p_sts;
COPY_OPT_SCTX(buf, BV_STS);
buf->b_p_sts_nopaste = p_sts_nopaste;
- buf->b_p_vsts = (char *)vim_strsave(p_vsts);
+ buf->b_p_vsts = xstrdup(p_vsts);
COPY_OPT_SCTX(buf, BV_VSTS);
- if (p_vsts && p_vsts != (char_u *)empty_option) {
+ if (p_vsts && p_vsts != empty_option) {
(void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
} else {
buf->b_p_vsts_array = NULL;
}
- buf->b_p_vsts_nopaste = p_vsts_nopaste
- ? (char *)vim_strsave(p_vsts_nopaste)
- : NULL;
+ buf->b_p_vsts_nopaste = p_vsts_nopaste ? xstrdup(p_vsts_nopaste) : NULL;
buf->b_p_com = xstrdup(p_com);
COPY_OPT_SCTX(buf, BV_COM);
- buf->b_p_cms = (char *)vim_strsave(p_cms);
+ buf->b_p_cms = xstrdup(p_cms);
COPY_OPT_SCTX(buf, BV_CMS);
- buf->b_p_fo = (char *)vim_strsave(p_fo);
+ buf->b_p_fo = xstrdup(p_fo);
COPY_OPT_SCTX(buf, BV_FO);
- buf->b_p_flp = (char *)vim_strsave(p_flp);
+ buf->b_p_flp = xstrdup(p_flp);
COPY_OPT_SCTX(buf, BV_FLP);
- buf->b_p_nf = (char *)vim_strsave(p_nf);
+ buf->b_p_nf = xstrdup(p_nf);
COPY_OPT_SCTX(buf, BV_NF);
- buf->b_p_mps = (char *)vim_strsave(p_mps);
+ buf->b_p_mps = xstrdup(p_mps);
COPY_OPT_SCTX(buf, BV_MPS);
buf->b_p_si = p_si;
COPY_OPT_SCTX(buf, BV_SI);
@@ -4569,25 +4561,25 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_smc = p_smc;
COPY_OPT_SCTX(buf, BV_SMC);
buf->b_s.b_syn_isk = empty_option;
- buf->b_s.b_p_spc = (char *)vim_strsave(p_spc);
+ buf->b_s.b_p_spc = xstrdup(p_spc);
COPY_OPT_SCTX(buf, BV_SPC);
(void)compile_cap_prog(&buf->b_s);
- buf->b_s.b_p_spf = (char *)vim_strsave(p_spf);
+ buf->b_s.b_p_spf = xstrdup(p_spf);
COPY_OPT_SCTX(buf, BV_SPF);
- buf->b_s.b_p_spl = (char *)vim_strsave(p_spl);
+ buf->b_s.b_p_spl = xstrdup(p_spl);
COPY_OPT_SCTX(buf, BV_SPL);
- buf->b_s.b_p_spo = (char *)vim_strsave(p_spo);
+ buf->b_s.b_p_spo = xstrdup(p_spo);
COPY_OPT_SCTX(buf, BV_SPO);
- buf->b_p_inde = (char *)vim_strsave(p_inde);
+ buf->b_p_inde = xstrdup(p_inde);
COPY_OPT_SCTX(buf, BV_INDE);
- buf->b_p_indk = (char *)vim_strsave(p_indk);
+ buf->b_p_indk = xstrdup(p_indk);
COPY_OPT_SCTX(buf, BV_INDK);
buf->b_p_fp = empty_option;
- buf->b_p_fex = (char *)vim_strsave(p_fex);
+ buf->b_p_fex = xstrdup(p_fex);
COPY_OPT_SCTX(buf, BV_FEX);
buf->b_p_sua = xstrdup(p_sua);
COPY_OPT_SCTX(buf, BV_SUA);
- buf->b_p_keymap = (char *)vim_strsave(p_keymap);
+ buf->b_p_keymap = xstrdup(p_keymap);
COPY_OPT_SCTX(buf, BV_KMAP);
buf->b_kmap_state |= KEYMAP_INIT;
// This isn't really an option, but copying the langmap and IME
@@ -4614,12 +4606,12 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_tc_flags = 0;
buf->b_p_def = empty_option;
buf->b_p_inc = empty_option;
- buf->b_p_inex = (char *)vim_strsave(p_inex);
+ buf->b_p_inex = xstrdup(p_inex);
COPY_OPT_SCTX(buf, BV_INEX);
buf->b_p_dict = empty_option;
buf->b_p_tsr = empty_option;
buf->b_p_tsrfu = empty_option;
- buf->b_p_qe = (char *)vim_strsave(p_qe);
+ buf->b_p_qe = xstrdup(p_qe);
COPY_OPT_SCTX(buf, BV_QE);
buf->b_p_udf = p_udf;
COPY_OPT_SCTX(buf, BV_UDF);
@@ -4634,7 +4626,7 @@ void buf_copy_options(buf_T *buf, int flags)
*/
if (dont_do_help) {
buf->b_p_isk = (char *)save_p_isk;
- if (p_vts && p_vts != (char_u *)empty_option && !buf->b_p_vts_array) {
+ if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) {
(void)tabstop_set(p_vts, &buf->b_p_vts_array);
} else {
buf->b_p_vts_array = NULL;
@@ -4645,9 +4637,9 @@ void buf_copy_options(buf_T *buf, int flags)
did_isk = true;
buf->b_p_ts = p_ts;
COPY_OPT_SCTX(buf, BV_TS);
- buf->b_p_vts = (char *)vim_strsave(p_vts);
+ buf->b_p_vts = xstrdup(p_vts);
COPY_OPT_SCTX(buf, BV_VTS);
- if (p_vts && p_vts != (char_u *)empty_option && !buf->b_p_vts_array) {
+ if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) {
(void)tabstop_set(p_vts, &buf->b_p_vts_array);
} else {
buf->b_p_vts_array = NULL;
@@ -4966,7 +4958,7 @@ void ExpandOldSetting(int *num_file, char ***file)
if (expand_option_idx >= 0) {
// Put string of option value in NameBuff.
option_value2string(&options[expand_option_idx], expand_option_flags);
- var = NameBuff;
+ var = (char_u *)NameBuff;
} else {
var = (char_u *)"";
}
@@ -4999,9 +4991,7 @@ void ExpandOldSetting(int *num_file, char ***file)
/// @param opt_flags OPT_GLOBAL and/or OPT_LOCAL
static void option_value2string(vimoption_T *opp, int opt_flags)
{
- char_u *varp;
-
- varp = get_varp_scope(opp, opt_flags);
+ char_u *varp = (char_u *)get_varp_scope(opp, opt_flags);
if (opp->flags & P_NUM) {
long wc = 0;
@@ -5023,7 +5013,7 @@ static void option_value2string(vimoption_T *opp, int opt_flags)
} else if (opp->flags & P_EXPAND) {
home_replace(NULL, (char *)varp, (char *)NameBuff, MAXPATHL, false);
// Translate 'pastetoggle' into special key names.
- } else if ((char_u **)opp->var == &p_pt) {
+ } else if ((char **)opp->var == &p_pt) {
str2specialbuf((const char *)p_pt, (char *)NameBuff, MAXPATHL);
} else {
STRLCPY(NameBuff, varp, MAXPATHL);
@@ -5052,7 +5042,7 @@ bool shortmess(int x)
return (p_shm != NULL
&& (vim_strchr(p_shm, x) != NULL
|| (vim_strchr(p_shm, 'a') != NULL
- && vim_strchr((char *)SHM_ALL_ABBREVIATIONS, x) != NULL)));
+ && vim_strchr(SHM_ALL_ABBREVIATIONS, x) != NULL)));
}
/// paste_option_changed() - Called after p_paste was set or reset.
@@ -5101,9 +5091,7 @@ static void paste_option_changed(void)
if (p_vsts_nopaste) {
xfree(p_vsts_nopaste);
}
- p_vsts_nopaste = p_vsts && p_vsts != (char_u *)empty_option
- ? vim_strsave(p_vsts)
- : NULL;
+ p_vsts_nopaste = p_vsts && p_vsts != empty_option ? xstrdup(p_vsts) : NULL;
}
// Always set the option values, also when 'paste' is set when it is
@@ -5137,9 +5125,9 @@ static void paste_option_changed(void)
p_sts = 0;
p_ai = 0;
if (p_vsts) {
- free_string_option((char *)p_vsts);
+ free_string_option(p_vsts);
}
- p_vsts = (char_u *)empty_option;
+ p_vsts = empty_option;
} else if (old_p_paste) {
// Paste switched from on to off: Restore saved values.
@@ -5156,7 +5144,7 @@ static void paste_option_changed(void)
buf->b_p_vsts = buf->b_p_vsts_nopaste ? xstrdup(buf->b_p_vsts_nopaste) : empty_option;
xfree(buf->b_p_vsts_array);
if (buf->b_p_vsts && buf->b_p_vsts != empty_option) {
- (void)tabstop_set((char_u *)buf->b_p_vsts, &buf->b_p_vsts_array);
+ (void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
} else {
buf->b_p_vsts_array = NULL;
}
@@ -5178,9 +5166,9 @@ static void paste_option_changed(void)
p_tw = p_tw_nopaste;
p_wm = p_wm_nopaste;
if (p_vsts) {
- free_string_option((char *)p_vsts);
+ free_string_option(p_vsts);
}
- p_vsts = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : (char_u *)empty_option;
+ p_vsts = p_vsts_nopaste ? xstrdup(p_vsts_nopaste) : empty_option;
}
old_p_paste = p_paste;
@@ -5248,20 +5236,20 @@ void fill_breakat_flags(void)
}
if (p_breakat != NULL) {
- for (p = p_breakat; *p; p++) {
+ for (p = (char_u *)p_breakat; *p; p++) {
breakat_flags[*p] = true;
}
}
}
/// fill_culopt_flags() -- called when 'culopt' changes value
-int fill_culopt_flags(char_u *val, win_T *wp)
+int fill_culopt_flags(char *val, win_T *wp)
{
- char_u *p;
+ char *p;
char_u culopt_flags_new = 0;
if (val == NULL) {
- p = (char_u *)wp->w_p_culopt;
+ p = wp->w_p_culopt;
} else {
p = val;
}
@@ -5473,7 +5461,7 @@ void set_fileformat(int eol_style, int opt_flags)
}
/// Skip to next part of an option argument: skip space and comma
-char_u *skip_to_option_part(const char_u *p)
+char *skip_to_option_part(const char *p)
{
if (*p == ',') {
p++;
@@ -5481,7 +5469,7 @@ char_u *skip_to_option_part(const char_u *p)
while (*p == ' ') {
p++;
}
- return (char_u *)p;
+ return (char *)p;
}
/// Isolate one part of a string option separated by `sep_chars`.
@@ -5516,7 +5504,7 @@ size_t copy_option_part(char **option, char *buf, size_t maxlen, char *sep_chars
if (*p != NUL && *p != ',') { // skip non-standard separator
p++;
}
- p = (char *)skip_to_option_part((char_u *)p); // p points to next file name
+ p = skip_to_option_part(p); // p points to next file name
*option = p;
return len;
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 59b8485272..6af6b16e86 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -258,7 +258,7 @@ enum {
SHM_SEARCHCOUNT = 'S', ///< Search sats: '[1/10]'
};
/// Represented by 'a' flag.
-#define SHM_ALL_ABBREVIATIONS ((char_u[]) { \
+#define SHM_ALL_ABBREVIATIONS ((char[]) { \
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
0, \
})
@@ -440,9 +440,9 @@ EXTERN unsigned bo_flags;
#define BO_WILD 0x40000
EXTERN char_u *p_bsk; // 'backupskip'
-EXTERN char_u *p_breakat; // 'breakat'
-EXTERN char_u *p_bh; ///< 'bufhidden'
-EXTERN char_u *p_bt; ///< 'buftype'
+EXTERN char *p_breakat; // 'breakat'
+EXTERN char *p_bh; ///< 'bufhidden'
+EXTERN char *p_bt; ///< 'buftype'
EXTERN char *p_cmp; // 'casemap'
EXTERN unsigned cmp_flags;
#define CMP_INTERNAL 0x001
@@ -459,8 +459,8 @@ EXTERN unsigned cb_flags;
#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
EXTERN long p_cwh; // 'cmdwinheight'
EXTERN long p_ch; // 'cmdheight'
-EXTERN char_u *p_cms; ///< 'commentstring'
-EXTERN char_u *p_cpt; ///< 'complete'
+EXTERN char *p_cms; ///< 'commentstring'
+EXTERN char *p_cpt; ///< 'complete'
EXTERN long p_columns; // 'columns'
EXTERN int p_confirm; // 'confirm'
EXTERN char *p_cot; // 'completeopt'
@@ -533,9 +533,9 @@ EXTERN unsigned fdo_flags;
#define FDO_INSERT 0x100
#define FDO_UNDO 0x200
#define FDO_JUMP 0x400
-EXTERN char_u *p_fex; ///< 'formatexpr'
-EXTERN char_u *p_flp; ///< 'formatlistpat'
-EXTERN char_u *p_fo; ///< 'formatoptions'
+EXTERN char *p_fex; ///< 'formatexpr'
+EXTERN char *p_flp; ///< 'formatlistpat'
+EXTERN char *p_fo; ///< 'formatoptions'
EXTERN char_u *p_fp; // 'formatprg'
EXTERN int p_fs; // 'fsync'
EXTERN int p_gd; // 'gdefault'
@@ -566,10 +566,10 @@ EXTERN int p_ic; // 'ignorecase'
EXTERN long p_iminsert; ///< 'iminsert'
EXTERN long p_imsearch; ///< 'imsearch'
EXTERN int p_inf; ///< 'infercase'
-EXTERN char_u *p_inex; ///< 'includeexpr'
+EXTERN char *p_inex; ///< 'includeexpr'
EXTERN int p_is; // 'incsearch'
-EXTERN char_u *p_inde; ///< 'indentexpr'
-EXTERN char_u *p_indk; ///< 'indentkeys'
+EXTERN char *p_inde; ///< 'indentexpr'
+EXTERN char *p_indk; ///< 'indentkeys'
EXTERN char *p_icm; // 'inccommand'
EXTERN char *p_isf; // 'isfname'
EXTERN char *p_isi; // 'isident'
@@ -580,7 +580,7 @@ EXTERN char *p_jop; // 'jumpooptions'
EXTERN unsigned jop_flags;
#define JOP_STACK 0x01
#define JOP_VIEW 0x02
-EXTERN char_u *p_keymap; ///< 'keymap'
+EXTERN char *p_keymap; ///< 'keymap'
EXTERN char_u *p_kp; // 'keywordprg'
EXTERN char *p_km; // 'keymodel'
EXTERN char *p_langmap; // 'langmap'
@@ -598,11 +598,11 @@ EXTERN char *p_lcs; // 'listchars'
EXTERN int p_lz; // 'lazyredraw'
EXTERN int p_lpl; // 'loadplugins'
EXTERN int p_magic; // 'magic'
-EXTERN char_u *p_menc; // 'makeencoding'
-EXTERN char *p_mef; // 'makeef'
-EXTERN char_u *p_mp; // 'makeprg'
-EXTERN char_u *p_mps; ///< 'matchpairs'
-EXTERN char_u *p_cc; // 'colorcolumn'
+EXTERN char *p_menc; // 'makeencoding'
+EXTERN char *p_mef; // 'makeef'
+EXTERN char_u *p_mp; // 'makeprg'
+EXTERN char *p_mps; ///< 'matchpairs'
+EXTERN char_u *p_cc; // 'colorcolumn'
EXTERN int p_cc_cols[256]; // array for 'colorcolumn' columns
EXTERN long p_mat; // 'matchtime'
EXTERN long p_mco; // 'maxcombine'
@@ -624,18 +624,18 @@ EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT);
EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT);
EXTERN long p_mouset; // 'mousetime'
EXTERN int p_more; // 'more'
-EXTERN char_u *p_nf; ///< 'nrformats'
+EXTERN char *p_nf; ///< 'nrformats'
EXTERN char *p_opfunc; // 'operatorfunc'
-EXTERN char_u *p_para; // 'paragraphs'
+EXTERN char_u *p_para; // 'paragraphs'
EXTERN int p_paste; // 'paste'
-EXTERN char_u *p_pt; // 'pastetoggle'
-EXTERN char_u *p_pex; // 'patchexpr'
-EXTERN char *p_pm; // 'patchmode'
-EXTERN char_u *p_path; // 'path'
-EXTERN char_u *p_cdpath; // 'cdpath'
+EXTERN char *p_pt; // 'pastetoggle'
+EXTERN char_u *p_pex; // 'patchexpr'
+EXTERN char *p_pm; // 'patchmode'
+EXTERN char_u *p_path; // 'path'
+EXTERN char_u *p_cdpath; // 'cdpath'
EXTERN int p_pi; ///< 'preserveindent'
EXTERN long p_pyx; // 'pyxversion'
-EXTERN char_u *p_qe; ///< 'quoteescape'
+EXTERN char *p_qe; ///< 'quoteescape'
EXTERN int p_ro; ///< 'readonly'
EXTERN char *p_rdb; // 'redrawdebug'
EXTERN unsigned rdb_flags;
@@ -685,13 +685,13 @@ EXTERN unsigned ssop_flags;
#define SSOP_TERMINAL 0x10000
#define SSOP_SKIP_RTP 0x20000
-EXTERN char_u *p_sh; // 'shell'
-EXTERN char_u *p_shcf; // 'shellcmdflag'
-EXTERN char_u *p_sp; // 'shellpipe'
-EXTERN char_u *p_shq; // 'shellquote'
-EXTERN char_u *p_sxq; // 'shellxquote'
-EXTERN char_u *p_sxe; // 'shellxescape'
-EXTERN char_u *p_srr; // 'shellredir'
+EXTERN char_u *p_sh; // 'shell'
+EXTERN char_u *p_shcf; // 'shellcmdflag'
+EXTERN char *p_sp; // 'shellpipe'
+EXTERN char_u *p_shq; // 'shellquote'
+EXTERN char_u *p_sxq; // 'shellxquote'
+EXTERN char_u *p_sxe; // 'shellxescape'
+EXTERN char *p_srr; // 'shellredir'
EXTERN int p_stmp; // 'shelltemp'
#ifdef BACKSLASH_IN_FILENAME
EXTERN int p_ssl; // 'shellslash'
@@ -727,11 +727,11 @@ EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter'
#define TPF_DEL 0x010
#define TPF_C0 0x020
#define TPF_C1 0x040
-EXTERN char_u *p_tfu; ///< 'tagfunc'
-EXTERN char_u *p_spc; ///< 'spellcapcheck'
-EXTERN char_u *p_spf; ///< 'spellfile'
-EXTERN char_u *p_spl; ///< 'spelllang'
-EXTERN char_u *p_spo; // 'spelloptions'
+EXTERN char *p_tfu; ///< 'tagfunc'
+EXTERN char *p_spc; ///< 'spellcapcheck'
+EXTERN char *p_spf; ///< 'spellfile'
+EXTERN char *p_spl; ///< 'spelllang'
+EXTERN char *p_spo; // 'spelloptions'
EXTERN char *p_sps; // 'spellsuggest'
EXTERN int p_spr; // 'splitright'
EXTERN int p_sol; // 'startofline'
@@ -745,7 +745,7 @@ EXTERN unsigned swb_flags;
#define SWB_NEWTAB 0x008
#define SWB_VSPLIT 0x010
#define SWB_USELAST 0x020
-EXTERN char_u *p_syn; ///< 'syntax'
+EXTERN char *p_syn; ///< 'syntax'
EXTERN long p_ts; ///< 'tabstop'
EXTERN int p_tbs; ///< 'tagbsearch'
EXTERN char *p_tc; ///< 'tagcase'
@@ -780,13 +780,13 @@ EXTERN long p_uc; ///< 'updatecount'
EXTERN long p_ut; ///< 'updatetime'
EXTERN char *p_shada; ///< 'shada'
EXTERN char *p_shadafile; ///< 'shadafile'
-EXTERN char_u *p_vsts; ///< 'varsofttabstop'
-EXTERN char_u *p_vts; ///< 'vartabstop'
+EXTERN char *p_vsts; ///< 'varsofttabstop'
+EXTERN char *p_vts; ///< 'vartabstop'
EXTERN char_u *p_vdir; ///< 'viewdir'
EXTERN char *p_vop; ///< 'viewoptions'
EXTERN unsigned vop_flags; ///< uses SSOP_ flags
EXTERN int p_vb; ///< 'visualbell'
-EXTERN char_u *p_ve; ///< 'virtualedit'
+EXTERN char *p_ve; ///< 'virtualedit'
EXTERN unsigned ve_flags;
#define VE_BLOCK 5U // includes "all"
#define VE_INSERT 6U // includes "all"
@@ -798,7 +798,7 @@ EXTERN long p_verbose; // 'verbose'
#ifdef IN_OPTION_C
char_u *p_vfile = (char_u *)""; // used before options are initialized
#else
-extern char_u *p_vfile; // 'verbosefile'
+extern char *p_vfile; // 'verbosefile'
#endif
EXTERN int p_warn; // 'warn'
EXTERN char *p_wop; // 'wildoptions'
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 808a70c8cb..1bdfcbecb9 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -113,30 +113,30 @@ static char *(p_tpf_values[]) = { "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NU
static char *(p_rdb_values[]) = { "compositor", "nothrottle", "invalid", "nodelta", NULL };
/// All possible flags for 'shm'.
-static char_u SHM_ALL[] = { SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW,
- SHM_WRI, SHM_ABBREVIATIONS, SHM_WRITE, SHM_TRUNC, SHM_TRUNCALL,
- SHM_OVER, SHM_OVERALL, SHM_SEARCH, SHM_ATTENTION, SHM_INTRO,
- SHM_COMPLETIONMENU, SHM_RECORDING, SHM_FILEINFO, SHM_SEARCHCOUNT, 0, };
+static char SHM_ALL[] = { SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW,
+ SHM_WRI, SHM_ABBREVIATIONS, SHM_WRITE, SHM_TRUNC, SHM_TRUNCALL,
+ SHM_OVER, SHM_OVERALL, SHM_SEARCH, SHM_ATTENTION, SHM_INTRO,
+ SHM_COMPLETIONMENU, SHM_RECORDING, SHM_FILEINFO, SHM_SEARCHCOUNT, 0, };
/// After setting various option values: recompute variables that depend on
/// option values.
void didset_string_options(void)
{
- (void)opt_strings_flags((char_u *)p_cmp, p_cmp_values, &cmp_flags, true);
- (void)opt_strings_flags((char_u *)p_bkc, p_bkc_values, &bkc_flags, true);
- (void)opt_strings_flags((char_u *)p_bo, p_bo_values, &bo_flags, true);
- (void)opt_strings_flags((char_u *)p_ssop, p_ssop_values, &ssop_flags, true);
- (void)opt_strings_flags((char_u *)p_vop, p_ssop_values, &vop_flags, true);
- (void)opt_strings_flags((char_u *)p_fdo, p_fdo_values, &fdo_flags, true);
- (void)opt_strings_flags((char_u *)p_dy, p_dy_values, &dy_flags, true);
- (void)opt_strings_flags((char_u *)p_rdb, p_rdb_values, &rdb_flags, true);
- (void)opt_strings_flags((char_u *)p_tc, p_tc_values, &tc_flags, false);
- (void)opt_strings_flags((char_u *)p_tpf, p_tpf_values, &tpf_flags, true);
+ (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true);
+ (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, true);
+ (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, true);
+ (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true);
+ (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true);
+ (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true);
+ (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, true);
+ (void)opt_strings_flags(p_rdb, p_rdb_values, &rdb_flags, true);
+ (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, false);
+ (void)opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, true);
- (void)opt_strings_flags((char_u *)p_swb, p_swb_values, &swb_flags, true);
- (void)opt_strings_flags((char_u *)p_wop, p_wop_values, &wop_flags, true);
- (void)opt_strings_flags((char_u *)p_jop, p_jop_values, &jop_flags, true);
- (void)opt_strings_flags((char_u *)p_cb, p_cb_values, &cb_flags, true);
+ (void)opt_strings_flags(p_swb, p_swb_values, &swb_flags, true);
+ (void)opt_strings_flags(p_wop, p_wop_values, &wop_flags, true);
+ (void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, true);
+ (void)opt_strings_flags(p_cb, p_cb_values, &cb_flags, true);
}
/// Trigger the OptionSet autocommand.
@@ -448,7 +448,7 @@ char *set_string_option(const int opt_idx, const char *const value, const int op
/// Return true if "val" is a valid 'filetype' name.
/// Also used for 'syntax' and 'keymap'.
-static bool valid_filetype(const char_u *val)
+static bool valid_filetype(const char *val)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return valid_name(val, ".-_");
@@ -520,7 +520,7 @@ static char *check_mousescroll(char *string)
/// Handle setting 'signcolumn' for value 'val'
///
/// @return OK when the value is valid, FAIL otherwise
-static int check_signcolumn(char_u *val)
+static int check_signcolumn(char *val)
{
if (*val == NUL) {
return FAIL;
@@ -637,13 +637,12 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
char *errmsg = NULL;
char *s, *p;
int did_chartab = false;
- char_u **gvarp;
bool free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
bool value_changed = false;
// Get the global option to compare with, otherwise we would have to check
// two values for all local options.
- gvarp = (char_u **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
+ char **gvarp = (char **)get_option_varp_scope(opt_idx, OPT_GLOBAL);
// Disallow changing some options from secure mode
if ((secure || sandbox != 0)
@@ -657,7 +656,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// path separator (slash and/or backslash), wildcards and characters that
// are often illegal in a file name. Be more permissive if "secure" is off.
errmsg = e_invarg;
- } else if (gvarp == (char_u **)&p_bkc) { // 'backupcopy'
+ } else if (gvarp == &p_bkc) { // 'backupcopy'
char *bkc = p_bkc;
unsigned int *flags = &bkc_flags;
@@ -670,7 +669,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// make the local value empty: use the global value
*flags = 0;
} else {
- if (opt_strings_flags((char_u *)bkc, p_bkc_values, flags, true) != OK) {
+ if (opt_strings_flags(bkc, p_bkc_values, flags, true) != OK) {
errmsg = e_invarg;
}
@@ -678,7 +677,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
+ ((*flags & BKC_YES) != 0)
+ ((*flags & BKC_NO) != 0) != 1) {
// Must have exactly one of "auto", "yes" and "no".
- (void)opt_strings_flags((char_u *)oldval, p_bkc_values, flags, true);
+ (void)opt_strings_flags(oldval, p_bkc_values, flags, true);
errmsg = e_invarg;
}
}
@@ -713,8 +712,8 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
} else if (varp == &p_rtp || varp == &p_pp) { // 'runtimepath' 'packpath'
runtime_search_path_invalidate();
} else if (varp == &curwin->w_p_culopt
- || gvarp == (char_u **)&curwin->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
- if (**varp == NUL || fill_culopt_flags((char_u *)(*varp), curwin) != OK) {
+ || gvarp == &curwin->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
+ if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK) {
errmsg = e_invarg;
}
} else if (varp == &curwin->w_p_cc) { // 'colorcolumn'
@@ -735,42 +734,42 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
errmsg = e_unsupportedoption;
}
} else if (varp == &p_jop) { // 'jumpoptions'
- if (opt_strings_flags((char_u *)p_jop, p_jop_values, &jop_flags, true) != OK) {
+ if (opt_strings_flags(p_jop, p_jop_values, &jop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == &p_nf) { // 'nrformats'
- if (check_opt_strings((char_u *)(*varp), p_nf_values, true) != OK) {
+ if (check_opt_strings(*varp, p_nf_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ssop) { // 'sessionoptions'
- if (opt_strings_flags((char_u *)p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
+ if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
errmsg = e_invarg;
}
if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) {
// Don't allow both "sesdir" and "curdir".
- (void)opt_strings_flags((char_u *)oldval, p_ssop_values, &ssop_flags, true);
+ (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, true);
errmsg = e_invarg;
}
} else if (varp == &p_vop) { // 'viewoptions'
- if (opt_strings_flags((char_u *)p_vop, p_ssop_values, &vop_flags, true) != OK) {
+ if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_rdb) { // 'redrawdebug'
- if (opt_strings_flags((char_u *)p_rdb, p_rdb_values, &rdb_flags, true) != OK) {
+ if (opt_strings_flags(p_rdb, p_rdb_values, &rdb_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_sbo) { // 'scrollopt'
- if (check_opt_strings((char_u *)p_sbo, p_scbopt_values, true) != OK) {
+ if (check_opt_strings(p_sbo, p_scbopt_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ambw || (int *)varp == &p_emoji) { // 'ambiwidth'
- if (check_opt_strings((char_u *)p_ambw, p_ambw_values, false) != OK) {
+ if (check_opt_strings(p_ambw, p_ambw_values, false) != OK) {
errmsg = e_invarg;
} else {
errmsg = check_chars_options();
}
} else if (varp == &p_bg) { // 'background'
- if (check_opt_strings((char_u *)p_bg, p_bg_values, false) == OK) {
+ if (check_opt_strings(p_bg, p_bg_values, false) == OK) {
int dark = (*p_bg == 'd');
init_highlight(false, false);
@@ -793,21 +792,21 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
errmsg = e_invarg;
}
} else if (varp == &p_wop) { // 'wildoptions'
- if (opt_strings_flags((char_u *)p_wop, p_wop_values, &wop_flags, true) != OK) {
+ if (opt_strings_flags(p_wop, p_wop_values, &wop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_wak) { // 'winaltkeys'
if (*p_wak == NUL
- || check_opt_strings((char_u *)p_wak, p_wak_values, false) != OK) {
+ || check_opt_strings(p_wak, p_wak_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ei) { // 'eventignore'
if (check_ei() == FAIL) {
errmsg = e_invarg;
}
- } else if (varp == &p_enc || gvarp == (char_u **)&p_fenc || gvarp == &p_menc) {
+ } else if (varp == &p_enc || gvarp == &p_fenc || gvarp == &p_menc) {
// 'encoding', 'fileencoding' and 'makeencoding'
- if (gvarp == (char_u **)&p_fenc) {
+ if (gvarp == &p_fenc) {
if (!MODIFIABLE(curbuf) && opt_flags != OPT_GLOBAL) {
errmsg = e_modifiable;
} else if (vim_strchr(*varp, ',') != NULL) {
@@ -824,7 +823,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (errmsg == NULL) {
// canonize the value, so that STRCMP() can be used on it
- p = (char *)enc_canonize((char_u *)(*varp));
+ p = enc_canonize(*varp);
xfree(*varp);
*varp = p;
if (varp == &p_enc) {
@@ -838,11 +837,11 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
} else if (varp == &p_penc) {
// Canonize printencoding if VIM standard one
- p = (char *)enc_canonize((char_u *)p_penc);
+ p = enc_canonize(p_penc);
xfree(p_penc);
p_penc = p;
} else if (varp == &curbuf->b_p_keymap) {
- if (!valid_filetype((char_u *)(*varp))) {
+ if (!valid_filetype(*varp)) {
errmsg = e_invarg;
} else {
int secure_save = secure;
@@ -883,10 +882,10 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
status_redraw_curbuf();
}
- } else if (gvarp == (char_u **)&p_ff) { // 'fileformat'
+ } else if (gvarp == &p_ff) { // 'fileformat'
if (!MODIFIABLE(curbuf) && !(opt_flags & OPT_GLOBAL)) {
errmsg = e_modifiable;
- } else if (check_opt_strings((char_u *)(*varp), p_ff_values, false) != OK) {
+ } else if (check_opt_strings(*varp, p_ff_values, false) != OK) {
errmsg = e_invarg;
} else {
redraw_titles();
@@ -899,7 +898,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
}
} else if (varp == &p_ffs) { // 'fileformats'
- if (check_opt_strings((char_u *)p_ffs, p_ff_values, true) != OK) {
+ if (check_opt_strings(p_ffs, p_ff_values, true) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == &p_mps) { // 'matchpairs'
@@ -923,7 +922,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
break;
}
}
- } else if (gvarp == (char_u **)&p_com) { // 'comments'
+ } else if (gvarp == &p_com) { // 'comments'
for (s = *varp; *s;) {
while (*s && *s != ':') {
if (vim_strchr(COM_ALL, *s) == NULL
@@ -947,13 +946,13 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
s++;
}
- s = (char *)skip_to_option_part((char_u *)s);
+ s = skip_to_option_part(s);
}
} else if (varp == &p_lcs || varp == &p_fcs) { // global 'listchars' or 'fillchars'
char **local_ptr = varp == &p_lcs ? &curwin->w_p_lcs : &curwin->w_p_fcs;
// only apply the global value to "curwin" when it does not have a local value
errmsg =
- set_chars_option(curwin, (char_u **)varp, **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
+ set_chars_option(curwin, varp, **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
if (errmsg == NULL) {
// If the current window is set to use the global
// 'listchars'/'fillchars' value, clear the window-local value.
@@ -967,18 +966,18 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// here, so ignore the return value.
local_ptr = varp == &p_lcs ? &wp->w_p_lcs : &wp->w_p_fcs;
if (**local_ptr == NUL) {
- (void)set_chars_option(wp, (char_u **)local_ptr, true);
+ (void)set_chars_option(wp, local_ptr, true);
}
}
redraw_all_later(UPD_NOT_VALID);
}
} else if (varp == &curwin->w_p_lcs) { // local 'listchars'
- errmsg = set_chars_option(curwin, (char_u **)varp, true);
+ errmsg = set_chars_option(curwin, varp, true);
} else if (varp == &curwin->w_p_fcs) { // local 'fillchars'
- errmsg = set_chars_option(curwin, (char_u **)varp, true);
+ errmsg = set_chars_option(curwin, varp, true);
} else if (varp == &p_cedit) { // 'cedit'
errmsg = check_cedit();
- } else if (varp == (char **)&p_vfile) { // 'verbosefile'
+ } else if (varp == &p_vfile) { // 'verbosefile'
verbose_stop();
if (*p_vfile != NUL && verbose_open() == FAIL) {
errmsg = e_invarg;
@@ -1037,7 +1036,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (*p_shada && errmsg == NULL && get_shada_parameter('\'') < 0) {
errmsg = N_("E528: Must specify a ' value");
}
- } else if (gvarp == (char_u **)&p_sbr) { // 'showbreak'
+ } else if (gvarp == &p_sbr) { // 'showbreak'
for (s = *varp; *s;) {
if (ptr2cells(s) != 1) {
errmsg = e_showbreak_contains_unprintable_or_wide_character;
@@ -1052,7 +1051,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
errmsg = parse_printmbfont();
} else if (varp == &p_langmap) { // 'langmap'
langmap_set();
- } else if (varp == (char **)&p_breakat) { // 'breakat'
+ } else if (varp == &p_breakat) { // 'breakat'
fill_breakat_flags();
} else if (varp == &p_titlestring || varp == &p_iconstring) {
// 'titlestring' and 'iconstring'
@@ -1067,47 +1066,47 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
did_set_title();
} else if (varp == &p_sel) { // 'selection'
if (*p_sel == NUL
- || check_opt_strings((char_u *)p_sel, p_sel_values, false) != OK) {
+ || check_opt_strings(p_sel, p_sel_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_slm) { // 'selectmode'
- if (check_opt_strings((char_u *)p_slm, p_slm_values, true) != OK) {
+ if (check_opt_strings(p_slm, p_slm_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_km) { // 'keymodel'
- if (check_opt_strings((char_u *)p_km, p_km_values, true) != OK) {
+ if (check_opt_strings(p_km, p_km_values, true) != OK) {
errmsg = e_invarg;
} else {
km_stopsel = (vim_strchr(p_km, 'o') != NULL);
km_startsel = (vim_strchr(p_km, 'a') != NULL);
}
} else if (varp == &p_mousem) { // 'mousemodel'
- if (check_opt_strings((char_u *)p_mousem, p_mousem_values, false) != OK) {
+ if (check_opt_strings(p_mousem, p_mousem_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_mousescroll) { // 'mousescroll'
errmsg = check_mousescroll(p_mousescroll);
} else if (varp == &p_swb) { // 'switchbuf'
- if (opt_strings_flags((char_u *)p_swb, p_swb_values, &swb_flags, true) != OK) {
+ if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_debug) { // 'debug'
- if (check_opt_strings((char_u *)p_debug, p_debug_values, true) != OK) {
+ if (check_opt_strings(p_debug, p_debug_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_dy) { // 'display'
- if (opt_strings_flags((char_u *)p_dy, p_dy_values, &dy_flags, true) != OK) {
+ if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK) {
errmsg = e_invarg;
} else {
(void)init_chartab();
msg_grid_validate();
}
} else if (varp == &p_ead) { // 'eadirection'
- if (check_opt_strings((char_u *)p_ead, p_ead_values, false) != OK) {
+ if (check_opt_strings(p_ead, p_ead_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_cb) { // 'clipboard'
- if (opt_strings_flags((char_u *)p_cb, p_cb_values, &cb_flags, true) != OK) {
+ if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &(curwin->w_s->b_p_spl) // 'spell'
@@ -1116,8 +1115,8 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// buffer in which 'spell' is set load the wordlists.
const bool is_spellfile = varp == &(curwin->w_s->b_p_spf);
- if ((is_spellfile && !valid_spellfile((char_u *)(*varp)))
- || (!is_spellfile && !valid_spelllang((char_u *)(*varp)))) {
+ if ((is_spellfile && !valid_spellfile(*varp))
+ || (!is_spellfile && !valid_spelllang(*varp))) {
errmsg = e_invarg;
} else {
errmsg = did_set_spell_option(is_spellfile);
@@ -1139,14 +1138,14 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
} else if (gvarp == &p_bh) {
// When 'bufhidden' is set, check for valid value.
- if (check_opt_strings((char_u *)curbuf->b_p_bh, p_bufhidden_values, false) != OK) {
+ if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, false) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == &p_bt) {
// When 'buftype' is set, check for valid value.
if ((curbuf->terminal && curbuf->b_p_bt[0] != 't')
|| (!curbuf->terminal && curbuf->b_p_bt[0] == 't')
- || check_opt_strings((char_u *)curbuf->b_p_bt, p_buftype_values, false) != OK) {
+ || check_opt_strings(curbuf->b_p_bt, p_buftype_values, false) != OK) {
errmsg = e_invarg;
} else {
if (curwin->w_status_height || global_stl_height()) {
@@ -1156,7 +1155,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
redraw_titles();
}
- } else if (gvarp == (char_u **)&p_stl || gvarp == (char_u **)&p_wbr || varp == &p_tal
+ } else if (gvarp == &p_stl || gvarp == &p_wbr || varp == &p_tal
|| varp == &p_ruf) {
// 'statusline', 'winbar', 'tabline' or 'rulerformat'
int wid;
@@ -1184,7 +1183,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
comp_col();
}
// add / remove window bars for 'winbar'
- if (gvarp == (char_u **)&p_wbr) {
+ if (gvarp == &p_wbr) {
set_winbar(true);
}
} else if (gvarp == &p_cpt) {
@@ -1223,7 +1222,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
}
} else if (varp == &p_cot) { // 'completeopt'
- if (check_opt_strings((char_u *)p_cot, p_cot_values, true) != OK) {
+ if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
errmsg = e_invarg;
} else {
completeopt_was_set();
@@ -1236,7 +1235,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
#endif
} else if (varp == &curwin->w_p_scl) { // 'signcolumn'
- if (check_signcolumn((char_u *)(*varp)) != OK) {
+ if (check_signcolumn(*varp) != OK) {
errmsg = e_invarg;
}
// When changing the 'signcolumn' to or from 'number', recompute the
@@ -1249,20 +1248,20 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
} else if (varp == &curwin->w_p_fdc
|| varp == &curwin->w_allbuf_opt.wo_fdc) {
// 'foldcolumn'
- if (**varp == NUL || check_opt_strings((char_u *)(*varp), p_fdc_values, false) != OK) {
+ if (**varp == NUL || check_opt_strings(*varp, p_fdc_values, false) != OK) {
errmsg = e_invarg;
}
- } else if (varp == (char **)&p_pt) {
+ } else if (varp == &p_pt) {
// 'pastetoggle': translate key codes like in a mapping
if (*p_pt) {
p = NULL;
- (void)replace_termcodes((char *)p_pt,
+ (void)replace_termcodes(p_pt,
STRLEN(p_pt),
&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
CPO_TO_CPO_FLAGS);
if (p != NULL) {
- free_string_option((char *)p_pt);
- p_pt = (char_u *)p;
+ free_string_option(p_pt);
+ p_pt = p;
}
}
} else if (varp == &p_bs) { // 'backspace'
@@ -1270,14 +1269,14 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (*p_bs > '3' || p_bs[1] != NUL) {
errmsg = e_invarg;
}
- } else if (check_opt_strings((char_u *)p_bs, p_bs_values, true) != OK) {
+ } else if (check_opt_strings(p_bs, p_bs_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_bo) {
- if (opt_strings_flags((char_u *)p_bo, p_bo_values, &bo_flags, true) != OK) {
+ if (opt_strings_flags(p_bo, p_bo_values, &bo_flags, true) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == (char_u **)&p_tc) { // 'tagcase'
+ } else if (gvarp == &p_tc) { // 'tagcase'
unsigned int *flags;
if (opt_flags & OPT_LOCAL) {
@@ -1292,19 +1291,19 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// make the local value empty: use the global value
*flags = 0;
} else if (*p == NUL
- || opt_strings_flags((char_u *)p, p_tc_values, flags, false) != OK) {
+ || opt_strings_flags(p, p_tc_values, flags, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_cmp) { // 'casemap'
- if (opt_strings_flags((char_u *)p_cmp, p_cmp_values, &cmp_flags, true) != OK) {
+ if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_dip) { // 'diffopt'
if (diffopt_changed() == FAIL) {
errmsg = e_invarg;
}
- } else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdm) { // 'foldmethod'
- if (check_opt_strings((char_u *)(*varp), p_fdm_values, false) != OK
+ } else if (gvarp == &curwin->w_allbuf_opt.wo_fdm) { // 'foldmethod'
+ if (check_opt_strings(*varp, p_fdm_values, false) != OK
|| *curwin->w_p_fdm == NUL) {
errmsg = e_invarg;
} else {
@@ -1317,7 +1316,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
if (foldmethodIsExpr(curwin)) {
foldUpdateAll(curwin);
}
- } else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker'
+ } else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker'
p = vim_strchr(*varp, ',');
if (p == NULL) {
errmsg = N_("E536: comma required");
@@ -1331,23 +1330,23 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
errmsg = N_("E537: 'commentstring' must be empty or contain %s");
}
} else if (varp == &p_fdo) { // 'foldopen'
- if (opt_strings_flags((char_u *)p_fdo, p_fdo_values, &fdo_flags, true) != OK) {
+ if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_fcl) { // 'foldclose'
- if (check_opt_strings((char_u *)p_fcl, p_fcl_values, true) != OK) {
+ if (check_opt_strings(p_fcl, p_fcl_values, true) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdi) { // 'foldignore'
+ } else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) { // 'foldignore'
if (foldmethodIsIndent(curwin)) {
foldUpdateAll(curwin);
}
} else if (gvarp == &p_ve) { // 'virtualedit'
- char_u *ve = p_ve;
+ char *ve = p_ve;
unsigned int *flags = &ve_flags;
if (opt_flags & OPT_LOCAL) {
- ve = (char_u *)curwin->w_p_ve;
+ ve = curwin->w_p_ve;
flags = &curwin->w_ve_flags;
}
@@ -1381,15 +1380,15 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
}
}
- } else if (gvarp == (char_u **)&p_cino) { // 'cinoptions'
+ } else if (gvarp == &p_cino) { // 'cinoptions'
// TODO(vim): recognize errors
parse_cino(curbuf);
} else if (varp == &p_icm) { // 'inccommand'
- if (check_opt_strings((char_u *)p_icm, p_icm_values, false) != OK) {
+ if (check_opt_strings(p_icm, p_icm_values, false) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == (char_u **)&p_ft) {
- if (!valid_filetype((char_u *)(*varp))) {
+ } else if (gvarp == &p_ft) {
+ if (!valid_filetype(*varp)) {
errmsg = e_invarg;
} else {
value_changed = STRCMP(oldval, *varp) != 0;
@@ -1399,7 +1398,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
*value_checked = true;
}
} else if (gvarp == &p_syn) {
- if (!valid_filetype((char_u *)(*varp))) {
+ if (!valid_filetype(*varp)) {
errmsg = e_invarg;
} else {
value_changed = STRCMP(oldval, *varp) != 0;
@@ -1413,20 +1412,20 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
errmsg = e_invarg;
}
} else if (varp == &p_tpf) {
- if (opt_strings_flags((char_u *)p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
+ if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
- char_u *cp;
+ char *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vsts_array);
} else {
- for (cp = (char_u *)(*varp); *cp; cp++) {
+ for (cp = *varp; *cp; cp++) {
if (ascii_isdigit(*cp)) {
continue;
}
- if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
+ if (*cp == ',' && cp > *varp && *(cp - 1) != ',') {
continue;
}
errmsg = e_invarg;
@@ -1434,7 +1433,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vsts_array;
- if (tabstop_set((char_u *)(*varp), &(curbuf->b_p_vsts_array))) {
+ if (tabstop_set(*varp, &(curbuf->b_p_vsts_array))) {
xfree(oldarray);
} else {
errmsg = e_invarg;
@@ -1442,16 +1441,16 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
}
} else if (varp == &(curbuf->b_p_vts)) { // 'vartabstop'
- char_u *cp;
+ char *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vts_array);
} else {
- for (cp = (char_u *)(*varp); *cp; cp++) {
+ for (cp = *varp; *cp; cp++) {
if (ascii_isdigit(*cp)) {
continue;
}
- if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
+ if (*cp == ',' && cp > *varp && *(cp - 1) != ',') {
continue;
}
errmsg = e_invarg;
@@ -1459,7 +1458,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vts_array;
- if (tabstop_set((char_u *)(*varp), &(curbuf->b_p_vts_array))) {
+ if (tabstop_set(*varp, &(curbuf->b_p_vts_array))) {
xfree(oldarray);
if (foldmethodIsIndent(curwin)) {
foldUpdateAll(curwin);
@@ -1484,7 +1483,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
p = WW_ALL;
}
if (varp == &p_shm) { // 'shortmess'
- p = (char *)SHM_ALL;
+ p = SHM_ALL;
} else if (varp == &(p_cpo)) { // 'cpoptions'
p = CPO_VI;
} else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
@@ -1527,7 +1526,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
&& is_global_local_option(opt_idx)) {
// global option with local value set to use global value; free
// the local value and make it empty
- p = (char *)get_option_varp_scope(opt_idx, OPT_LOCAL);
+ p = get_option_varp_scope(opt_idx, OPT_LOCAL);
free_string_option(*(char **)p);
*(char **)p = empty_option;
} else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) {
@@ -1574,8 +1573,8 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
}
}
if (varp == &(curwin->w_s->b_p_spl)) {
- char_u fname[200];
- char_u *q = (char_u *)curwin->w_s->b_p_spl;
+ char fname[200];
+ char *q = curwin->w_s->b_p_spl;
// Skip the first name if it is "cjk".
if (STRNCMP(q, "cjk,", 4) == 0) {
@@ -1586,15 +1585,14 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
// They could set 'spellcapcheck' depending on the language.
// Use the first name in 'spelllang' up to '_region' or
// '.encoding'.
- for (p = (char *)q; *p != NUL; p++) {
+ for (p = q; *p != NUL; p++) {
if (!ASCII_ISALNUM(*p) && *p != '-') {
break;
}
}
- if (p > (char *)q) {
- vim_snprintf((char *)fname, sizeof(fname), "spell/%.*s.vim",
- (int)(p - (char *)q), q);
- source_runtime((char *)fname, DIP_ALL);
+ if (p > q) {
+ vim_snprintf(fname, sizeof(fname), "spell/%.*s.vim", (int)(p - q), q);
+ source_runtime(fname, DIP_ALL);
}
}
}
@@ -1618,7 +1616,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf
/// @param list when true: accept a list of values
///
/// @return OK for correct value, FAIL otherwise. Empty is always OK.
-static int check_opt_strings(char_u *val, char **values, int list)
+static int check_opt_strings(char *val, char **values, int list)
{
return opt_strings_flags(val, values, NULL, list);
}
@@ -1631,7 +1629,7 @@ static int check_opt_strings(char_u *val, char **values, int list)
/// @param list when true: accept a list of values
///
/// @return OK for correct value, FAIL otherwise. Empty is always OK.
-static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, bool list)
+static int opt_strings_flags(char *val, char **values, unsigned *flagp, bool list)
{
unsigned int new_flags = 0;
@@ -1659,7 +1657,7 @@ static int opt_strings_flags(char_u *val, char **values, unsigned *flagp, bool l
}
/// @return OK if "p" is a valid fileformat name, FAIL otherwise.
-int check_ff_value(char_u *p)
+int check_ff_value(char *p)
{
return check_opt_strings(p, p_ff_values, false);
}
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index f528bc651b..1b548e1f1b 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -607,7 +607,7 @@ static efm_T *parse_efm_option(char *efm)
goto parse_efm_error;
}
// Advance to next part
- efm = (char *)skip_to_option_part((char_u *)efm + len); // skip comma and spaces
+ efm = skip_to_option_part(efm + len); // skip comma and spaces
}
if (fmt_first == NULL) { // nothing found
@@ -4222,7 +4222,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname)
// If 'shellpipe' empty: don't redirect to 'errorfile'.
if (*p_sp != NUL) {
- append_redir(cmd, len, (char *)p_sp, (char *)fname);
+ append_redir(cmd, len, p_sp, (char *)fname);
}
// Display the fully formed command. Output a newline if there's something
@@ -4241,7 +4241,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname)
// Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd"
void ex_make(exarg_T *eap)
{
- char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : (char *)p_menc;
+ char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
// Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal".
if (grep_internal(eap->cmdidx)) {
@@ -4981,7 +4981,7 @@ void ex_cfile(exarg_T *eap)
set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0);
}
- char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : (char *)p_menc;
+ char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
if (is_loclist_cmd(eap->cmdidx)) {
wp = curwin;
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 23606fdc77..25f85b6193 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -2432,7 +2432,7 @@ void ex_scriptencoding(exarg_T *eap)
}
if (*eap->arg != NUL) {
- name = (char *)enc_canonize((char_u *)eap->arg);
+ name = enc_canonize(eap->arg);
} else {
name = eap->arg;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 9c1064d608..3258dc11d6 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -734,13 +734,13 @@ int showmode(void)
length = (Rows - msg_row) * Columns - 3;
}
if (edit_submode_extra != NULL) {
- length -= vim_strsize((char *)edit_submode_extra);
+ length -= vim_strsize(edit_submode_extra);
}
if (length > 0) {
if (edit_submode_pre != NULL) {
- length -= vim_strsize((char *)edit_submode_pre);
+ length -= vim_strsize(edit_submode_pre);
}
- if (length - vim_strsize((char *)edit_submode) > 0) {
+ if (length - vim_strsize(edit_submode) > 0) {
if (edit_submode_pre != NULL) {
msg_puts_attr((const char *)edit_submode_pre, attr);
}
@@ -1026,7 +1026,7 @@ void draw_tabline(void)
if (col + len >= Columns - 3) {
break;
}
- grid_puts_len(&default_grid, NameBuff, len, 0, col,
+ grid_puts_len(&default_grid, (char_u *)NameBuff, len, 0, col,
hl_combine_attr(attr, win_hl_attr(cwp, HLF_T)));
col += len;
}
@@ -1040,9 +1040,9 @@ void draw_tabline(void)
if (room > 0) {
// Get buffer name in NameBuff[]
get_trans_bufname(cwp->w_buffer);
- shorten_dir(NameBuff);
+ shorten_dir((char_u *)NameBuff);
len = vim_strsize((char *)NameBuff);
- p = NameBuff;
+ p = (char_u *)NameBuff;
while (len > room) {
len -= ptr2cells((char *)p);
MB_PTR_ADV(p);
@@ -1295,13 +1295,13 @@ static int get_encoded_char_adv(const char_u **p)
/// @param varp either the global or the window-local value.
/// @param apply if false, do not store the flags, only check for errors.
/// @return error message, NULL if it's OK.
-char *set_chars_option(win_T *wp, char_u **varp, bool apply)
+char *set_chars_option(win_T *wp, char **varp, bool apply)
{
const char_u *last_multispace = NULL; // Last occurrence of "multispace:"
const char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
int multispace_len = 0; // Length of lcs-multispace string
int lead_multispace_len = 0; // Length of lcs-leadmultispace string
- const bool is_listchars = (varp == (char_u **)&p_lcs || varp == (char_u **)&wp->w_p_lcs);
+ const bool is_listchars = (varp == &p_lcs || varp == &wp->w_p_lcs);
struct chars_tab {
int *cp; ///< char value
@@ -1344,17 +1344,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
struct chars_tab *tab;
int entries;
- const char_u *value = *varp;
+ const char_u *value = (char_u *)(*varp);
if (is_listchars) {
tab = lcs_tab;
entries = ARRAY_SIZE(lcs_tab);
- if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
+ if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
value = (char_u *)p_lcs; // local value is empty, use the global value
}
} else {
tab = fcs_tab;
entries = ARRAY_SIZE(fcs_tab);
- if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
+ if (varp == &wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
value = (char_u *)p_fcs; // local value is empty, use the global value
}
}
@@ -1520,17 +1520,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
/// @return an untranslated error message if any of them is invalid, NULL otherwise.
char *check_chars_options(void)
{
- if (set_chars_option(curwin, (char_u **)&p_lcs, false) != NULL) {
+ if (set_chars_option(curwin, &p_lcs, false) != NULL) {
return e_conflicts_with_value_of_listchars;
}
- if (set_chars_option(curwin, (char_u **)&p_fcs, false) != NULL) {
+ if (set_chars_option(curwin, &p_fcs, false) != NULL) {
return e_conflicts_with_value_of_fillchars;
}
FOR_ALL_TAB_WINDOWS(tp, wp) {
- if (set_chars_option(wp, (char_u **)&wp->w_p_lcs, true) != NULL) {
+ if (set_chars_option(wp, &wp->w_p_lcs, true) != NULL) {
return e_conflicts_with_value_of_listchars;
}
- if (set_chars_option(wp, (char_u **)&wp->w_p_fcs, true) != NULL) {
+ if (set_chars_option(wp, &wp->w_p_fcs, true) != NULL) {
return e_conflicts_with_value_of_fillchars;
}
}
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 3de16b3e69..b45a041d96 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -1477,7 +1477,7 @@ static char *shada_filename(const char *file)
// because various expansions must have already be done by the shell.
// If shell is not performing them then they should be done in main.c
// where arguments are parsed, *not here*.
- expand_env((char_u *)file, &(NameBuff[0]), MAXPATHL);
+ expand_env((char_u *)file, (char_u *)&(NameBuff[0]), MAXPATHL);
file = (const char *)&(NameBuff[0]);
}
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 8fcb379bcf..10923829c3 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1848,7 +1848,7 @@ char *did_set_spelllang(win_T *wp)
region = NULL;
len = (int)STRLEN(lang);
- if (!valid_spelllang(lang)) {
+ if (!valid_spelllang((char *)lang)) {
continue;
}
@@ -3545,18 +3545,18 @@ int expand_spelling(linenr_T lnum, char_u *pat, char ***matchp)
return ga.ga_len;
}
-/// Return true if "val" is a valid 'spelllang' value.
-bool valid_spelllang(const char_u *val)
+/// @return true if "val" is a valid 'spelllang' value.
+bool valid_spelllang(const char *val)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return valid_name(val, ".-_,@");
}
-/// Return true if "val" is a valid 'spellfile' value.
-bool valid_spellfile(const char_u *val)
+/// @return true if "val" is a valid 'spellfile' value.
+bool valid_spellfile(const char *val)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- for (const char_u *s = val; *s != NUL; s++) {
+ for (const char_u *s = (char_u *)val; *s != NUL; s++) {
if (!vim_isfilec(*s) && *s != ',' && *s != ' ') {
return false;
}
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index c68dbd8e53..8d6307f123 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -2121,7 +2121,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (itemcnt > 0) {
if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL) {
// Setup for conversion from "ENC" to 'encoding'.
- aff->af_enc = enc_canonize(items[1]);
+ aff->af_enc = (char_u *)enc_canonize((char *)items[1]);
if (!spin->si_ascii
&& convert_setup(&spin->si_conv, aff->af_enc, (char_u *)p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
@@ -2167,9 +2167,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
STRCAT(p, " ");
STRCAT(p, items[1]);
spin->si_info = p;
- } else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
- && midword == NULL) {
- midword = getroom_save(spin, items[1]);
+ } else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) && midword == NULL) {
+ midword = (char_u *)getroom_save(spin, items[1]);
} else if (is_aff_rule(items, itemcnt, "TRY", 2)) {
// ignored, we look in the tree for what chars may appear
}
@@ -2307,12 +2306,12 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
}
if (i >= gap->ga_len) {
ga_grow(gap, 2);
- ((char **)(gap->ga_data))[gap->ga_len++] = (char *)getroom_save(spin, items[1]);
- ((char **)(gap->ga_data))[gap->ga_len++] = (char *)getroom_save(spin, items[2]);
+ ((char **)(gap->ga_data))[gap->ga_len++] = getroom_save(spin, items[1]);
+ ((char **)(gap->ga_data))[gap->ga_len++] = getroom_save(spin, items[2]);
}
} else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
&& syllable == NULL) {
- syllable = getroom_save(spin, items[1]);
+ syllable = (char_u *)getroom_save(spin, items[1]);
} else if (is_aff_rule(items, itemcnt, "NOBREAK", 1)) {
spin->si_nobreak = true;
} else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1)) {
@@ -2445,10 +2444,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
aff_entry = getroom(spin, sizeof(*aff_entry), true);
if (STRCMP(items[2], "0") != 0) {
- aff_entry->ae_chop = getroom_save(spin, items[2]);
+ aff_entry->ae_chop = (char_u *)getroom_save(spin, items[2]);
}
if (STRCMP(items[3], "0") != 0) {
- aff_entry->ae_add = getroom_save(spin, items[3]);
+ aff_entry->ae_add = (char_u *)getroom_save(spin, items[3]);
// Recognize flags on the affix: abcd/XYZ
aff_entry->ae_flags = (char_u *)vim_strchr((char *)aff_entry->ae_add, '/');
@@ -2468,7 +2467,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (STRCMP(items[4], ".") != 0) {
char_u buf[MAXLINELEN];
- aff_entry->ae_cond = getroom_save(spin, items[4]);
+ aff_entry->ae_cond = (char_u *)getroom_save(spin, items[4]);
if (*items[0] == 'P') {
sprintf((char *)buf, "^%s", items[4]);
} else {
@@ -2517,7 +2516,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (aff_entry->ae_cond != NULL) {
char_u buf[MAXLINELEN];
onecap_copy(items[4], buf, true);
- aff_entry->ae_cond = getroom_save(spin, buf);
+ aff_entry->ae_cond = (char_u *)getroom_save(spin, buf);
if (aff_entry->ae_cond != NULL) {
sprintf((char *)buf, "^%s",
aff_entry->ae_cond);
@@ -2547,7 +2546,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
idx = spin->si_prefcond.ga_len;
pp = GA_APPEND_VIA_PTR(char_u *, &spin->si_prefcond);
*pp = (aff_entry->ae_cond == NULL) ?
- NULL : getroom_save(spin, aff_entry->ae_cond);
+ NULL : (char_u *)getroom_save(spin, aff_entry->ae_cond);
}
// Add the prefix to the prefix tree.
@@ -2673,10 +2672,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
}
} else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
&& sofofrom == NULL) {
- sofofrom = getroom_save(spin, items[1]);
+ sofofrom = (char_u *)getroom_save(spin, items[1]);
} else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
&& sofoto == NULL) {
- sofoto = getroom_save(spin, items[1]);
+ sofoto = (char_u *)getroom_save(spin, items[1]);
} else if (STRCMP(items[0], "COMMON") == 0) {
int i;
@@ -3042,9 +3041,9 @@ static void add_fromto(spellinfo_T *spin, garray_T *gap, char_u *from, char_u *t
fromto_T *ftp = GA_APPEND_VIA_PTR(fromto_T, gap);
(void)spell_casefold(curwin, from, (int)STRLEN(from), word, MAXWLEN);
- ftp->ft_from = getroom_save(spin, word);
+ ftp->ft_from = (char_u *)getroom_save(spin, word);
(void)spell_casefold(curwin, to, (int)STRLEN(to), word, MAXWLEN);
- ftp->ft_to = getroom_save(spin, word);
+ ftp->ft_to = (char_u *)getroom_save(spin, word);
}
// Converts a boolean argument in a SAL line to true or false;
@@ -3207,7 +3206,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
}
// Store the word in the hashtable to be able to find duplicates.
- dw = getroom_save(spin, w);
+ dw = (char_u *)getroom_save(spin, w);
if (dw == NULL) {
retval = FAIL;
xfree(pc);
@@ -3728,7 +3727,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
// Setup for conversion to 'encoding'.
line += 9;
- enc = enc_canonize(line);
+ enc = (char_u *)enc_canonize((char *)line);
if (!spin->si_ascii
&& convert_setup(&spin->si_conv, enc, (char_u *)p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
@@ -3864,9 +3863,10 @@ static void *getroom(spellinfo_T *spin, size_t len, bool align)
return p;
}
-// Make a copy of a string into memory allocated with getroom().
-// Returns NULL when out of memory.
-static char_u *getroom_save(spellinfo_T *spin, char_u *s)
+/// Make a copy of a string into memory allocated with getroom().
+///
+/// @return NULL when out of memory.
+static char *getroom_save(spellinfo_T *spin, char_u *s)
{
const size_t s_size = STRLEN(s) + 1;
return memcpy(getroom(spin, s_size, false), s, s_size);
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 8b56eaadf0..b9cddb7b94 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -77,7 +77,7 @@ void win_redr_status(win_T *wp)
width = is_stl_global ? Columns : wp->w_width;
get_trans_bufname(wp->w_buffer);
- p = NameBuff;
+ p = (char_u *)NameBuff;
len = (int)STRLEN(p);
if (bt_help(wp->w_buffer)
@@ -138,7 +138,7 @@ void win_redr_status(win_T *wp)
if (get_keymap_str(wp, "<%s>", (char *)NameBuff, MAXPATHL)
&& this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) {
- grid_puts(&default_grid, NameBuff, row,
+ grid_puts(&default_grid, (char_u *)NameBuff, row,
(int)((size_t)this_ru_col - STRLEN(NameBuff) - 1), attr);
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 20287089f7..187dc4eed4 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -1634,11 +1634,9 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
bool zero_width_next_list = false;
garray_T zero_width_next_ga;
- /*
- * No character, no attributes! Past end of line?
- * Do try matching with an empty line (could be the start of a region).
- */
- line = syn_getcurline();
+ // No character, no attributes! Past end of line?
+ // Do try matching with an empty line (could be the start of a region).
+ line = (char_u *)syn_getcurline();
if (line[current_col] == NUL && current_col != 0) {
/*
* If we found a match after the last column, use it.
@@ -1706,12 +1704,10 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
if (syn_block->b_syn_containedin || cur_si == NULL
|| cur_si->si_cont_list != NULL) {
- /*
- * 2. Check for keywords, if on a keyword char after a non-keyword
- * char. Don't do this when syncing.
- */
+ // 2. Check for keywords, if on a keyword char after a non-keyword
+ // char. Don't do this when syncing.
if (do_keywords) {
- line = syn_getcurline();
+ line = (char_u *)syn_getcurline();
const char_u *cur_pos = line + current_col;
if (vim_iswordp_buf(cur_pos, syn_buf)
&& (current_col == 0
@@ -1979,13 +1975,11 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
* Handle searching for nextgroup match.
*/
if (current_next_list != NULL && !keep_next_list) {
- /*
- * If a nextgroup was not found, continue looking for one if:
- * - this is an empty line and the "skipempty" option was given
- * - we are on white space and the "skipwhite" option was given
- */
+ // If a nextgroup was not found, continue looking for one if:
+ // - this is an empty line and the "skipempty" option was given
+ // - we are on white space and the "skipwhite" option was given
if (!found_match) {
- line = syn_getcurline();
+ line = (char_u *)syn_getcurline();
if (((current_next_flags & HL_SKIPWHITE)
&& ascii_iswhite(line[current_col]))
|| ((current_next_flags & HL_SKIPEMPTY)
@@ -2108,7 +2102,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
// nextgroup ends at end of line, unless "skipnl" or "skipempty" present
if (current_next_list != NULL
- && (line = syn_getcurline())[current_col] != NUL
+ && (line = (char_u *)syn_getcurline())[current_col] != NUL
&& line[current_col + 1] == NUL
&& !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))) {
current_next_list = NULL;
@@ -2874,12 +2868,10 @@ static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *s
result->col = col;
}
-/*
- * Get current line in syntax buffer.
- */
-static char_u *syn_getcurline(void)
+/// Get current line in syntax buffer.
+static char *syn_getcurline(void)
{
- return ml_get_buf(syn_buf, current_lnum, false);
+ return (char *)ml_get_buf(syn_buf, current_lnum, false);
}
/*
@@ -4059,7 +4051,7 @@ static char *get_group_name(char *arg, char **name_end)
///
/// @return a pointer to the next argument (which isn't an option).
/// Return NULL for any error;
-static char_u *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
+static char *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
{
char_u *gname_start, *gname;
int syn_id;
@@ -4205,7 +4197,7 @@ static char_u *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char,
}
}
- return (char_u *)arg;
+ return arg;
}
/*
@@ -4347,7 +4339,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
cnt = 0;
p = keyword_copy;
for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
- rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest)) {
break;
}
@@ -4442,18 +4434,18 @@ static void syn_cmd_match(exarg_T *eap, int syncing)
syn_opt_arg.cont_list = NULL;
syn_opt_arg.cont_in_list = NULL;
syn_opt_arg.next_list = NULL;
- rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
// get the pattern.
init_syn_patterns();
CLEAR_FIELD(item);
- rest = (char *)get_syn_pattern((char_u *)rest, &item);
+ rest = get_syn_pattern((char_u *)rest, &item);
if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL)) {
syn_opt_arg.flags |= HL_HAS_EOL;
}
// Get options after the pattern
- rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest != NULL) { // all arguments are valid
/*
@@ -4568,7 +4560,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
// get the options, patterns and matchgroup.
while (rest != NULL && !ends_excmd(*rest)) {
// Check for option arguments
- rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest)) {
break;
}
@@ -4639,7 +4631,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
assert(item == ITEM_SKIP || item == ITEM_END);
reg_do_extmatch = REX_USE;
}
- rest = (char *)get_syn_pattern((char_u *)rest, ppp->pp_synp);
+ rest = get_syn_pattern((char_u *)rest, ppp->pp_synp);
reg_do_extmatch = 0;
if (item == ITEM_END && vim_regcomp_had_eol()
&& !(syn_opt_arg.flags & HL_EXCLUDENL)) {
@@ -5034,12 +5026,11 @@ static void init_syn_patterns(void)
ga_set_growsize(&curwin->w_s->b_syn_patterns, 10);
}
-/*
- * Get one pattern for a ":syntax match" or ":syntax region" command.
- * Stores the pattern and program in a synpat_T.
- * Returns a pointer to the next argument, or NULL in case of an error.
- */
-static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
+/// Get one pattern for a ":syntax match" or ":syntax region" command.
+/// Stores the pattern and program in a synpat_T.
+///
+/// @return a pointer to the next argument, or NULL in case of an error.
+static char *get_syn_pattern(char_u *arg, synpat_T *ci)
{
char *end;
int *p;
@@ -5128,7 +5119,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
semsg(_("E402: Garbage after pattern: %s"), arg);
return NULL;
}
- return (char_u *)skipwhite(end);
+ return skipwhite(end);
}
/*
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 2e5ce972d8..50121832ba 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -57,6 +57,7 @@
typedef struct tag_pointers {
// filled in by parse_tag_line():
char_u *tagname; // start of tag name (skip "file:")
+ //
char_u *tagname_end; // char after tag name
char_u *fname; // first char of file name
char_u *fname_end; // char after file name
@@ -483,8 +484,8 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
flags |= TAG_NO_TAGFUNC;
}
- if (find_tags(name, &new_num_matches, &new_matches, flags,
- max_num_matches, buf_ffname) == OK
+ if (find_tags((char *)name, &new_num_matches, &new_matches, flags,
+ max_num_matches, (char *)buf_ffname) == OK
&& new_num_matches < max_num_matches) {
max_num_matches = MAXCOL; // If less than max_num_matches
// found: all matches found.
@@ -1365,8 +1366,8 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
/// @param matchesp return: array of matches found
/// @param mincount MAXCOL: find all matches other: minimal number of matches */
/// @param buf_ffname name of buffer for priority
-int find_tags(char_u *pat, int *num_matches, char ***matchesp, int flags, int mincount,
- char_u *buf_ffname)
+int find_tags(char *pat, int *num_matches, char ***matchesp, int flags, int mincount,
+ char *buf_ffname)
{
FILE *fp;
char_u *lbuf; // line buffer
@@ -1459,17 +1460,17 @@ int find_tags(char_u *pat, int *num_matches, char ***matchesp, int flags, int mi
p_ic = false;
break;
case TC_FOLLOWSCS:
- p_ic = ignorecase(pat);
+ p_ic = ignorecase((char_u *)pat);
break;
case TC_SMART:
- p_ic = ignorecase_opt(pat, true, true);
+ p_ic = ignorecase_opt((char_u *)pat, true, true);
break;
default:
abort();
}
help_save = curbuf->b_help;
- orgpat.pat = pat;
+ orgpat.pat = (char_u *)pat;
orgpat.regmatch.regprog = NULL;
vimconv.vc_type = CONV_NONE;
@@ -1503,8 +1504,8 @@ int find_tags(char_u *pat, int *num_matches, char ***matchesp, int flags, int mi
if (orgpat.len > 3 && pat[orgpat.len - 3] == '@'
&& ASCII_ISALPHA(pat[orgpat.len - 2])
&& ASCII_ISALPHA(pat[orgpat.len - 1])) {
- saved_pat = vim_strnsave(pat, (size_t)orgpat.len - 3);
- help_lang_find = &pat[orgpat.len - 2];
+ saved_pat = vim_strnsave((char_u *)pat, (size_t)orgpat.len - 3);
+ help_lang_find = (char_u *)&pat[orgpat.len - 2];
orgpat.pat = saved_pat;
orgpat.len -= 3;
}
@@ -1527,8 +1528,8 @@ int find_tags(char_u *pat, int *num_matches, char ***matchesp, int flags, int mi
if (*curbuf->b_p_tfu != NUL && use_tfu && !tfu_in_use) {
tfu_in_use = true;
- retval = find_tagfunc_tags(pat, &ga_match[0], &match_count,
- flags, buf_ffname);
+ retval = find_tagfunc_tags((char_u *)pat, &ga_match[0], &match_count, flags,
+ (char_u *)buf_ffname);
tfu_in_use = false;
if (retval != NOTDONE) {
goto findtag_end;
@@ -2055,7 +2056,7 @@ parse_line:
} else {
// Decide in which array to store this match.
is_current = test_for_current(tagp.fname, tagp.fname_end, tag_fname,
- buf_ffname);
+ (char_u *)buf_ffname);
is_static = test_for_static(&tagp);
// Decide in which of the sixteen tables to store this match.
@@ -3107,13 +3108,13 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char ***file)
extra_flag = 0;
}
if (pat[0] == '/') {
- ret = find_tags(pat + 1, num_file, file,
+ ret = find_tags((char *)pat + 1, num_file, file,
TAG_REGEXP | extra_flag | TAG_VERBOSE | TAG_NO_TAGFUNC,
- TAG_MANY, (char_u *)curbuf->b_ffname);
+ TAG_MANY, curbuf->b_ffname);
} else {
- ret = find_tags(pat, num_file, file,
+ ret = find_tags((char *)pat, num_file, file,
TAG_REGEXP | extra_flag | TAG_VERBOSE | TAG_NO_TAGFUNC | TAG_NOIC,
- TAG_MANY, (char_u *)curbuf->b_ffname);
+ TAG_MANY, curbuf->b_ffname);
}
if (ret == OK && !tagnames) {
// Reorganize the tags for display and matching as strings of:
@@ -3150,8 +3151,7 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char ***file)
///
/// @param start start of the value
/// @param end after the value; can be NULL
-static int add_tag_field(dict_T *dict, const char *field_name, const char_u *start,
- const char_u *end)
+static int add_tag_field(dict_T *dict, const char *field_name, const char *start, const char *end)
FUNC_ATTR_NONNULL_ARG(1, 2)
{
int len = 0;
@@ -3198,8 +3198,8 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
tagptrs_T tp;
bool is_static;
- ret = find_tags(pat, &num_matches, &matches,
- TAG_REGEXP | TAG_NOIC, MAXCOL, buf_fname);
+ ret = find_tags((char *)pat, &num_matches, &matches,
+ TAG_REGEXP | TAG_NOIC, MAXCOL, (char *)buf_fname);
if (ret == OK && num_matches > 0) {
for (i = 0; i < num_matches; i++) {
int parse_result = parse_match((char_u *)matches[i], &tp);
@@ -3220,11 +3220,11 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
tv_list_append_dict(list, dict);
full_fname = tag_full_fname(&tp);
- if (add_tag_field(dict, "name", tp.tagname, tp.tagname_end) == FAIL
- || add_tag_field(dict, "filename", full_fname, NULL) == FAIL
- || add_tag_field(dict, "cmd", tp.command, tp.command_end) == FAIL
- || add_tag_field(dict, "kind", tp.tagkind,
- tp.tagkind ? tp.tagkind_end : NULL) == FAIL
+ if (add_tag_field(dict, "name", (char *)tp.tagname, (char *)tp.tagname_end) == FAIL
+ || add_tag_field(dict, "filename", (char *)full_fname, NULL) == FAIL
+ || add_tag_field(dict, "cmd", (char *)tp.command, (char *)tp.command_end) == FAIL
+ || add_tag_field(dict, "kind", (char *)tp.tagkind,
+ tp.tagkind ? (char *)tp.tagkind_end : NULL) == FAIL
|| tv_dict_add_nr(dict, S_LEN("static"), is_static) == FAIL) {
ret = FAIL;
}
@@ -3259,7 +3259,7 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
p++;
}
n[len] = NUL;
- if (add_tag_field(dict, (char *)n, s, p) == FAIL) {
+ if (add_tag_field(dict, (char *)n, (char *)s, (char *)p) == FAIL) {
ret = FAIL;
}
n[len] = ':';