aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-11-22 11:02:24 +0100
committerGitHub <noreply@github.com>2022-11-22 11:02:24 +0100
commitcd386b2c72eaacd9acac27380ee34db1accad9cb (patch)
tree15f906032e4091204450ed197da3ad97ddcb5049 /src
parent5eb5f4948826e9d47685ea9e257409cc3e693614 (diff)
parent40f3f75867bf03abfd90e0389a38197a00d37af1 (diff)
downloadrneovim-cd386b2c72eaacd9acac27380ee34db1accad9cb.tar.gz
rneovim-cd386b2c72eaacd9acac27380ee34db1accad9cb.tar.bz2
rneovim-cd386b2c72eaacd9acac27380ee34db1accad9cb.zip
Merge pull request #20151 from dundargoc/refactor/char_u/13
refactor: replace char_u with char 13: remove `STRLEN` part 3
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/private/helpers.c2
-rw-r--r--src/nvim/charset.c6
-rw-r--r--src/nvim/cmdexpand.c80
-rw-r--r--src/nvim/cursor.c18
-rw-r--r--src/nvim/diff.c12
-rw-r--r--src/nvim/eval/funcs.c14
-rw-r--r--src/nvim/ex_docmd.c6
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/file_search.c112
-rw-r--r--src/nvim/fileio.c19
-rw-r--r--src/nvim/help.c6
-rw-r--r--src/nvim/indent_c.c2
-rw-r--r--src/nvim/insexpand.c13
-rw-r--r--src/nvim/mapping.c41
-rw-r--r--src/nvim/memline.c28
-rw-r--r--src/nvim/normal.c12
-rw-r--r--src/nvim/ops.c42
-rw-r--r--src/nvim/option.c72
-rw-r--r--src/nvim/option_defs.h2
-rw-r--r--src/nvim/optionstr.c4
-rw-r--r--src/nvim/os/env.c58
-rw-r--r--src/nvim/os/shell.c44
-rw-r--r--src/nvim/path.c88
-rw-r--r--src/nvim/profile.c2
-rw-r--r--src/nvim/quickfix.c4
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/search.c294
-rw-r--r--src/nvim/search.h2
-rw-r--r--src/nvim/shada.c4
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/spellfile.c10
-rw-r--r--src/nvim/spellsuggest.c4
-rw-r--r--src/nvim/tag.c18
33 files changed, 513 insertions, 512 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index b7cd0c82fb..ca8ad16cbf 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -505,7 +505,7 @@ String buf_get_text(buf_T *buf, int64_t lnum, int64_t start_col, int64_t end_col
return rv;
}
- return cstrn_as_string((char *)&bufstr[start_col], (size_t)(end_col - start_col));
+ return cstrn_as_string(&bufstr[start_col], (size_t)(end_col - start_col));
}
void api_free_string(String value)
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 82a4698058..1f9b8f9a65 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -274,7 +274,7 @@ int buf_init_chartab(buf_T *buf, int global)
/// @param bufsize
void trans_characters(char *buf, int bufsize)
{
- char_u *trs; // translated character
+ char *trs; // translated character
int len = (int)strlen(buf); // length of string needing translation
int room = bufsize - len; // room in buffer after string
@@ -284,8 +284,8 @@ void trans_characters(char *buf, int bufsize)
if ((trs_len = utfc_ptr2len(buf)) > 1) {
len -= trs_len;
} else {
- trs = transchar_byte((uint8_t)(*buf));
- trs_len = (int)STRLEN(trs);
+ trs = (char *)transchar_byte((uint8_t)(*buf));
+ trs_len = (int)strlen(trs);
if (trs_len > 1) {
room -= trs_len - 1;
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 39865d7508..79ffd7552d 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -180,7 +180,7 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
CmdlineInfo *const ccline = get_cmdline_info();
int i, j;
char_u *p1;
- char_u *p2;
+ char *p2;
int difflen;
if (xp->xp_numfiles == -1) {
@@ -210,7 +210,7 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
if (type == WILD_NEXT || type == WILD_PREV || type == WILD_PUM_WANT) {
// Get next/previous match for a previous expanded pattern.
- p2 = (char_u *)ExpandOne(xp, NULL, NULL, 0, type);
+ p2 = ExpandOne(xp, NULL, NULL, 0, type);
} else {
// Translate string into pattern and expand it.
p1 = (char_u *)addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
@@ -220,8 +220,8 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
| WILD_SILENT
| (escape ? WILD_ESCAPE : 0)
| (p_wic ? WILD_ICASE : 0));
- p2 = (char_u *)ExpandOne(xp, (char *)p1, xstrnsave(&ccline->cmdbuff[i], xp->xp_pattern_len),
- use_options, type);
+ p2 = ExpandOne(xp, (char *)p1, xstrnsave(&ccline->cmdbuff[i], xp->xp_pattern_len),
+ use_options, type);
xfree(p1);
// xp->xp_pattern might have been modified by ExpandOne (for example,
@@ -237,14 +237,14 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
break;
}
}
- if ((int)STRLEN(p2) < j) {
+ if ((int)strlen(p2) < j) {
XFREE_CLEAR(p2);
}
}
}
if (p2 != NULL && !got_int) {
- difflen = (int)STRLEN(p2) - (int)(xp->xp_pattern_len);
+ difflen = (int)strlen(p2) - (int)(xp->xp_pattern_len);
if (ccline->cmdlen + difflen + 4 > ccline->cmdbufflen) {
realloc_cmdbuff(ccline->cmdlen + difflen + 4);
xp->xp_pattern = ccline->cmdbuff + i;
@@ -253,7 +253,7 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
memmove(&ccline->cmdbuff[ccline->cmdpos + difflen],
&ccline->cmdbuff[ccline->cmdpos],
(size_t)ccline->cmdlen - (size_t)ccline->cmdpos + 1);
- memmove(&ccline->cmdbuff[i], p2, STRLEN(p2));
+ memmove(&ccline->cmdbuff[i], p2, strlen(p2));
ccline->cmdlen += difflen;
ccline->cmdpos += difflen;
}
@@ -588,7 +588,7 @@ static char *ExpandOne_start(int mode, expand_T *xp, char *str, int options)
char *ss = NULL;
// Do the expansion.
- if (ExpandFromContext(xp, (char_u *)str, &xp->xp_numfiles, &xp->xp_files, options) == FAIL) {
+ if (ExpandFromContext(xp, str, &xp->xp_numfiles, &xp->xp_files, options) == FAIL) {
#ifdef FNAME_ILLEGAL
// Illegal file name has been silently skipped. But when there
// are wildcards, the real problem is that there was no match,
@@ -1600,13 +1600,13 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_doautoall:
return (const char *)set_context_in_autocmd(xp, (char *)arg, true);
case CMD_set:
- set_context_in_set_cmd(xp, (char_u *)arg, 0);
+ set_context_in_set_cmd(xp, (char *)arg, 0);
break;
case CMD_setglobal:
- set_context_in_set_cmd(xp, (char_u *)arg, OPT_GLOBAL);
+ set_context_in_set_cmd(xp, (char *)arg, OPT_GLOBAL);
break;
case CMD_setlocal:
- set_context_in_set_cmd(xp, (char_u *)arg, OPT_LOCAL);
+ set_context_in_set_cmd(xp, (char *)arg, OPT_LOCAL);
break;
case CMD_tag:
case CMD_stag:
@@ -2163,7 +2163,7 @@ int expand_cmdline(expand_T *xp, const char_u *str, int col, int *matchcount, ch
}
// find all files that match the description
- if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL) {
+ if (ExpandFromContext(xp, (char *)file_str, matchcount, matches, options) == FAIL) {
*matchcount = 0;
*matches = NULL;
}
@@ -2352,7 +2352,7 @@ static int ExpandOther(expand_T *xp, regmatch_T *rmp, int *num_file, char ***fil
/// Do the expansion based on xp->xp_context and "pat".
///
/// @param options WILD_ flags
-static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***file, int options)
+static int ExpandFromContext(expand_T *xp, char *pat, int *num_file, char ***file, int options)
{
regmatch_T regmatch;
int ret;
@@ -2381,7 +2381,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES
|| xp->xp_context == EXPAND_FILES_IN_PATH) {
- return expand_files_and_dirs(xp, (char *)pat, file, num_file, flags, options);
+ return expand_files_and_dirs(xp, pat, file, num_file, flags, options);
}
*file = NULL;
@@ -2389,7 +2389,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
if (xp->xp_context == EXPAND_HELP) {
// With an empty argument we would get all the help tags, which is
// very slow. Get matches for "help" instead.
- if (find_help_tags(*pat == NUL ? "help" : (char *)pat,
+ if (find_help_tags(*pat == NUL ? "help" : pat,
num_file, file, false) == OK) {
cleanup_help_tags(*num_file, *file);
return OK;
@@ -2399,7 +2399,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
if (xp->xp_context == EXPAND_SHELLCMD) {
*file = NULL;
- expand_shellcmd((char *)pat, num_file, file, flags);
+ expand_shellcmd(pat, num_file, file, flags);
return OK;
}
if (xp->xp_context == EXPAND_OLD_SETTING) {
@@ -2407,30 +2407,30 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
return OK;
}
if (xp->xp_context == EXPAND_BUFFERS) {
- return ExpandBufnames((char *)pat, num_file, file, options);
+ return ExpandBufnames(pat, num_file, file, options);
}
if (xp->xp_context == EXPAND_DIFF_BUFFERS) {
- return ExpandBufnames((char *)pat, num_file, file, options | BUF_DIFF_FILTER);
+ return ExpandBufnames(pat, num_file, file, options | BUF_DIFF_FILTER);
}
if (xp->xp_context == EXPAND_TAGS
|| xp->xp_context == EXPAND_TAGS_LISTFILES) {
- return expand_tags(xp->xp_context == EXPAND_TAGS, pat, num_file, file);
+ return expand_tags(xp->xp_context == EXPAND_TAGS, (char_u *)pat, num_file, file);
}
if (xp->xp_context == EXPAND_COLORS) {
char *directories[] = { "colors", NULL };
- return ExpandRTDir((char *)pat, DIP_START + DIP_OPT + DIP_LUA, num_file, file, directories);
+ return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_LUA, num_file, file, directories);
}
if (xp->xp_context == EXPAND_COMPILER) {
char *directories[] = { "compiler", NULL };
- return ExpandRTDir((char *)pat, DIP_LUA, num_file, file, directories);
+ return ExpandRTDir(pat, DIP_LUA, num_file, file, directories);
}
if (xp->xp_context == EXPAND_OWNSYNTAX) {
char *directories[] = { "syntax", NULL };
- return ExpandRTDir((char *)pat, 0, num_file, file, directories);
+ return ExpandRTDir(pat, 0, num_file, file, directories);
}
if (xp->xp_context == EXPAND_FILETYPE) {
char *directories[] = { "syntax", "indent", "ftplugin", NULL };
- return ExpandRTDir((char *)pat, DIP_LUA, num_file, file, directories);
+ return ExpandRTDir(pat, DIP_LUA, num_file, file, directories);
}
if (xp->xp_context == EXPAND_USER_LIST) {
return ExpandUserList(xp, num_file, file);
@@ -2439,32 +2439,32 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***f
return ExpandUserLua(xp, num_file, file);
}
if (xp->xp_context == EXPAND_PACKADD) {
- return ExpandPackAddDir((char *)pat, num_file, file);
+ return ExpandPackAddDir(pat, num_file, file);
}
// When expanding a function name starting with s:, match the <SNR>nr_
// prefix.
char *tofree = NULL;
if (xp->xp_context == EXPAND_USER_FUNC && STRNCMP(pat, "^s:", 3) == 0) {
- const size_t len = STRLEN(pat) + 20;
+ const size_t len = strlen(pat) + 20;
tofree = xmalloc(len);
snprintf(tofree, len, "^<SNR>\\d\\+_%s", pat + 3);
- pat = (char_u *)tofree;
+ pat = tofree;
}
if (xp->xp_context == EXPAND_LUA) {
ILOG("PAT %s", pat);
- return nlua_expand_pat(xp, (char *)pat, num_file, file);
+ return nlua_expand_pat(xp, pat, num_file, file);
}
- regmatch.regprog = vim_regcomp((char *)pat, p_magic ? RE_MAGIC : 0);
+ regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL) {
return FAIL;
}
// set ignore-case according to p_ic, p_scs and pat
- regmatch.rm_ic = ignorecase(pat);
+ regmatch.rm_ic = ignorecase((char_u *)pat);
if (xp->xp_context == EXPAND_SETTINGS
|| xp->xp_context == EXPAND_BOOL_SETTINGS) {
@@ -2651,19 +2651,19 @@ static void expand_shellcmd(char *filepat, int *num_file, char ***file, int flag
ga_grow(&ga, *num_file);
{
for (i = 0; i < *num_file; i++) {
- char_u *name = (char_u *)(*file)[i];
+ char *name = (*file)[i];
- if (STRLEN(name) > l) {
+ if (strlen(name) > l) {
// Check if this name was already found.
- hash_T hash = hash_hash(name + l);
+ hash_T hash = hash_hash((char_u *)name + l);
hashitem_T *hi =
hash_lookup(&found_ht, (const char *)(name + l),
- STRLEN(name + l), hash);
+ strlen(name + l), hash);
if (HASHITEM_EMPTY(hi)) {
// Remove the path that was prepended.
STRMOVE(name, name + l);
- ((char_u **)ga.ga_data)[ga.ga_len++] = name;
- hash_add_item(&found_ht, hi, name, hash);
+ ((char **)ga.ga_data)[ga.ga_len++] = name;
+ hash_add_item(&found_ht, hi, (char_u *)name, hash);
name = NULL;
}
}
@@ -2834,14 +2834,14 @@ void globpath(char *path, char *file, garray_T *ga, int expand_options)
ExpandInit(&xpc);
xpc.xp_context = EXPAND_FILES;
- char_u *buf = xmalloc(MAXPATHL);
+ char *buf = xmalloc(MAXPATHL);
// Loop over all entries in {path}.
while (*path != NUL) {
// Copy one item of the path to buf[] and concatenate the file name.
- copy_option_part(&path, (char *)buf, MAXPATHL, ",");
- if (STRLEN(buf) + strlen(file) + 2 < MAXPATHL) {
- add_pathsep((char *)buf);
+ copy_option_part(&path, buf, MAXPATHL, ",");
+ if (strlen(buf) + strlen(file) + 2 < MAXPATHL) {
+ add_pathsep(buf);
STRCAT(buf, file); // NOLINT
char **p;
@@ -2849,7 +2849,7 @@ void globpath(char *path, char *file, garray_T *ga, int expand_options)
(void)ExpandFromContext(&xpc, buf, &num_p, &p,
WILD_SILENT | expand_options);
if (num_p > 0) {
- ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT | expand_options);
+ ExpandEscape(&xpc, (char_u *)buf, num_p, p, WILD_SILENT | expand_options);
// Concatenate new results to previous ones.
ga_grow(ga, num_p);
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c
index 811f397cb8..84a2cf83ac 100644
--- a/src/nvim/cursor.c
+++ b/src/nvim/cursor.c
@@ -108,14 +108,14 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
|| (VIsual_active && *p_sel != 'o')
|| ((get_ve_flags() & VE_ONEMORE) && wcol < MAXCOL);
- char_u *line = (char_u *)ml_get_buf(curbuf, pos->lnum, false);
+ char *line = ml_get_buf(curbuf, pos->lnum, false);
if (wcol >= MAXCOL) {
- idx = (int)STRLEN(line) - 1 + one_more;
+ idx = (int)strlen(line) - 1 + one_more;
col = wcol;
if ((addspaces || finetune) && !VIsual_active) {
- curwin->w_curswant = linetabsize(line) + one_more;
+ curwin->w_curswant = linetabsize((char_u *)line) + one_more;
if (curwin->w_curswant > 0) {
curwin->w_curswant--;
}
@@ -129,7 +129,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
&& curwin->w_width_inner != 0
&& wcol >= (colnr_T)width
&& width > 0) {
- csize = linetabsize(line);
+ csize = linetabsize((char_u *)line);
if (csize > 0) {
csize--;
}
@@ -145,7 +145,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
}
chartabsize_T cts;
- init_chartabsize_arg(&cts, curwin, pos->lnum, 0, (char *)line, (char *)line);
+ init_chartabsize_arg(&cts, curwin, pos->lnum, 0, line, line);
while (cts.cts_vcol <= wcol && *cts.cts_ptr != NUL) {
// Count a tab for what it's worth (if list mode not on)
csize = win_lbr_chartabsize(&cts, &head);
@@ -153,7 +153,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
cts.cts_vcol += csize;
}
col = cts.cts_vcol;
- idx = (int)(cts.cts_ptr - (char *)line);
+ idx = (int)(cts.cts_ptr - line);
clear_chartabsize_arg(&cts);
// Handle all the special cases. The virtual_active() check
@@ -188,7 +188,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a
col = wcol;
} else {
// Break a tab
- int linelen = (int)STRLEN(line);
+ int linelen = (int)strlen(line);
int correct = wcol - col - csize + 1; // negative!!
char_u *newline;
@@ -315,8 +315,8 @@ void check_pos(buf_T *buf, pos_T *pos)
}
if (pos->col > 0) {
- char_u *line = (char_u *)ml_get_buf(buf, pos->lnum, false);
- colnr_T len = (colnr_T)STRLEN(line);
+ char *line = ml_get_buf(buf, pos->lnum, false);
+ colnr_T len = (colnr_T)strlen(line);
if (pos->col > len) {
pos->col = len;
}
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 4b71142c11..121b98d047 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1043,7 +1043,7 @@ static int check_external_diff(diffio_T *diffio)
for (;;) {
// For normal diff there must be a line that contains
// "1c1". For unified diff "@@ -1 +1 @@".
- if (vim_fgets((char_u *)linebuf, LBUFLEN, fd)) {
+ if (vim_fgets(linebuf, LBUFLEN, fd)) {
break;
}
@@ -1218,9 +1218,9 @@ void ex_diffpatch(exarg_T *eap)
esc_name =
(char *)vim_strsave_shellescape((char_u *)(fullname != NULL ? fullname : eap->arg), true, true);
#else
- esc_name = vim_strsave_shellescape(eap->arg, true, true);
+ esc_name = (char *)vim_strsave_shellescape(eap->arg, true, true);
#endif
- size_t buflen = STRLEN(tmp_orig) + STRLEN(esc_name) + STRLEN(tmp_new) + 16;
+ size_t buflen = strlen(tmp_orig) + strlen(esc_name) + strlen(tmp_new) + 16;
buf = xmalloc(buflen);
#ifdef UNIX
@@ -1557,7 +1557,7 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
{
for (;;) {
char line[LBUFLEN]; // only need to hold the diff line
- if (vim_fgets((char_u *)line, LBUFLEN, fd)) {
+ if (vim_fgets(line, LBUFLEN, fd)) {
return true; // end of file
}
@@ -1577,9 +1577,9 @@ static bool extract_hunk(FILE *fd, diffhunk_T *hunk, diffstyle_T *diffstyle)
} else if ((STRNCMP(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
} else if ((STRNCMP(line, "--- ", 4) == 0) // -V501
- && (vim_fgets((char_u *)line, LBUFLEN, fd) == 0) // -V501
+ && (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "+++ ", 4) == 0)
- && (vim_fgets((char_u *)line, LBUFLEN, fd) == 0) // -V501
+ && (vim_fgets(line, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "@@ ", 3) == 0)) {
*diffstyle = DIFF_UNIFIED;
} else {
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 8666aa4f35..8ab1178b17 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2343,13 +2343,13 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST) {
xfree(fresult);
}
- fresult = find_file_in_path_option(first ? (char_u *)fname : NULL,
- first ? strlen(fname) : 0,
- 0, first, path,
- find_what, (char_u *)curbuf->b_ffname,
- (find_what == FINDFILE_DIR
- ? (char_u *)""
- : (char_u *)curbuf->b_p_sua));
+ fresult = (char_u *)find_file_in_path_option(first ? (char *)fname : NULL,
+ first ? strlen(fname) : 0,
+ 0, first, (char *)path,
+ find_what, curbuf->b_ffname,
+ (find_what == FINDFILE_DIR
+ ? ""
+ : curbuf->b_p_sua));
first = false;
if (fresult != NULL && rettv->v_type == VAR_LIST) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 0733bcf683..a2bd6fb43f 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3378,7 +3378,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
}
searchcmdlen = 0;
flags = silent ? 0 : SEARCH_HIS | SEARCH_MSG;
- if (!do_search(NULL, c, c, (char_u *)cmd, 1L, flags, NULL)) {
+ if (!do_search(NULL, c, c, cmd, 1L, flags, NULL)) {
curwin->w_cursor = pos;
cmd = NULL;
goto error;
@@ -3831,7 +3831,7 @@ 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, (char_u *)NameBuff, MAXPATHL, true, true, NULL);
+ expand_env_esc(eap->arg, NameBuff, MAXPATHL, true, true, NULL);
has_wildcards = path_has_wildcard(NameBuff);
p = (char *)NameBuff;
} else {
@@ -5541,7 +5541,7 @@ bool changedir_func(char *new_dir, CdScope scope)
bool dir_differs = pdir == NULL || pathcmp(pdir, new_dir, -1) != 0;
if (dir_differs) {
do_autocmd_dirchanged(new_dir, scope, kCdCauseManual, true);
- if (vim_chdir((char_u *)new_dir) != 0) {
+ if (vim_chdir(new_dir) != 0) {
emsg(_(e_failed));
xfree(pdir);
return false;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 89d295e1a8..fc9559172f 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -439,7 +439,7 @@ static void may_do_incsearch_highlighting(int firstc, long count, incsearch_stat
.sa_tm = &tm,
};
found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim,
- (char_u *)ccline.cmdbuff + skiplen, count,
+ ccline.cmdbuff + skiplen, count,
search_flags, &sia);
ccline.cmdbuff[skiplen + patlen] = next_char;
emsg_off--;
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index 1d891799a5..36d58923b0 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -82,8 +82,8 @@ typedef struct ff_stack {
// the fix part (no wildcards) and the part containing the wildcards
// of the search path
- char_u *ffs_fix_path;
- char_u *ffs_wc_path;
+ char *ffs_fix_path;
+ char *ffs_wc_path;
// files/dirs found in the above directory, matched by the first wildcard
// of wc_part
@@ -511,7 +511,7 @@ char_u *vim_findfile_stopdir(char_u *buf)
while (*r_ptr != NUL && *r_ptr != ';') {
if (r_ptr[0] == '\\' && r_ptr[1] == ';') {
// Overwrite the escape char,
- // use STRLEN(r_ptr) to move the trailing '\0'.
+ // use strlen(r_ptr) to move the trailing '\0'.
STRMOVE(r_ptr, r_ptr + 1);
r_ptr++;
}
@@ -553,12 +553,12 @@ void vim_findfile_cleanup(void *ctx)
/// NULL if nothing found.
char_u *vim_findfile(void *search_ctx_arg)
{
- char_u *file_path;
- char_u *rest_of_wildcards;
+ char *file_path;
+ char *rest_of_wildcards;
char_u *path_end = NULL;
ff_stack_T *stackp = NULL;
size_t len;
- char_u *p;
+ char *p;
char *suf;
ff_search_ctx_T *search_ctx;
@@ -612,7 +612,7 @@ char_u *vim_findfile(void *search_ctx_arg)
// first time (hence stackp->ff_filearray == NULL)
if (stackp->ffs_filearray == NULL
&& ff_check_visited(&search_ctx->ffsc_dir_visited_list->ffvl_visited_list,
- (char *)stackp->ffs_fix_path, (char *)stackp->ffs_wc_path) == FAIL) {
+ stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL) {
#ifdef FF_VERBOSE
if (p_verbose >= 5) {
verbose_enter_scroll();
@@ -650,37 +650,37 @@ char_u *vim_findfile(void *search_ctx_arg)
char *dirptrs[2];
// we use filepath to build the path expand_wildcards() should expand.
- dirptrs[0] = (char *)file_path;
+ dirptrs[0] = file_path;
dirptrs[1] = NULL;
// if we have a start dir copy it in
- if (!vim_isAbsName(stackp->ffs_fix_path)
+ if (!vim_isAbsName((char_u *)stackp->ffs_fix_path)
&& search_ctx->ffsc_start_dir) {
if (strlen(search_ctx->ffsc_start_dir) + 1 >= MAXPATHL) {
ff_free_stack_element(stackp);
goto fail;
}
STRCPY(file_path, search_ctx->ffsc_start_dir);
- if (!add_pathsep((char *)file_path)) {
+ if (!add_pathsep(file_path)) {
ff_free_stack_element(stackp);
goto fail;
}
}
// append the fix part of the search path
- if (STRLEN(file_path) + STRLEN(stackp->ffs_fix_path) + 1 >= MAXPATHL) {
+ if (strlen(file_path) + strlen(stackp->ffs_fix_path) + 1 >= MAXPATHL) {
ff_free_stack_element(stackp);
goto fail;
}
STRCAT(file_path, stackp->ffs_fix_path);
- if (!add_pathsep((char *)file_path)) {
+ if (!add_pathsep(file_path)) {
ff_free_stack_element(stackp);
goto fail;
}
rest_of_wildcards = stackp->ffs_wc_path;
if (*rest_of_wildcards != NUL) {
- len = STRLEN(file_path);
+ len = strlen(file_path);
if (STRNCMP(rest_of_wildcards, "**", 2) == 0) {
// pointer to the restrict byte
// The restrict byte is not a character!
@@ -705,7 +705,7 @@ char_u *vim_findfile(void *search_ctx_arg)
if (stackp->ffs_star_star_empty == 0) {
// if not done before, expand '**' to empty
stackp->ffs_star_star_empty = 1;
- dirptrs[1] = (char *)stackp->ffs_fix_path;
+ dirptrs[1] = stackp->ffs_fix_path;
}
}
@@ -748,7 +748,7 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray_cur = 0;
stackp->ffs_stage = 0;
} else {
- rest_of_wildcards = &stackp->ffs_wc_path[STRLEN(stackp->ffs_wc_path)];
+ rest_of_wildcards = &stackp->ffs_wc_path[strlen(stackp->ffs_wc_path)];
}
if (stackp->ffs_stage == 0) {
@@ -768,7 +768,7 @@ char_u *vim_findfile(void *search_ctx_arg)
goto fail;
}
STRCPY(file_path, stackp->ffs_filearray[i]);
- if (!add_pathsep((char *)file_path)) {
+ if (!add_pathsep(file_path)) {
ff_free_stack_element(stackp);
goto fail;
}
@@ -776,7 +776,7 @@ char_u *vim_findfile(void *search_ctx_arg)
// Try without extra suffix and then with suffixes
// from 'suffixesadd'.
- len = STRLEN(file_path);
+ len = strlen(file_path);
if (search_ctx->ffsc_tagfile) {
suf = "";
} else {
@@ -784,14 +784,14 @@ char_u *vim_findfile(void *search_ctx_arg)
}
for (;;) {
// if file exists and we didn't already find it
- if ((path_with_url((char *)file_path)
- || (os_path_exists((char *)file_path)
+ if ((path_with_url(file_path)
+ || (os_path_exists(file_path)
&& (search_ctx->ffsc_find_what == FINDFILE_BOTH
|| ((search_ctx->ffsc_find_what == FINDFILE_DIR)
- == os_isdir((char *)file_path)))))
+ == os_isdir(file_path)))))
#ifndef FF_VERBOSE
&& (ff_check_visited(&search_ctx->ffsc_visited_list->ffvl_visited_list,
- (char *)file_path, "") == OK)
+ file_path, "") == OK)
#endif
) {
#ifdef FF_VERBOSE
@@ -812,12 +812,11 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray_cur = i + 1;
ff_push(search_ctx, stackp);
- if (!path_with_url((char *)file_path)) {
- simplify_filename(file_path);
+ if (!path_with_url(file_path)) {
+ simplify_filename((char_u *)file_path);
}
- if (os_dirname((char_u *)ff_expand_buffer, MAXPATHL)
- == OK) {
- p = (char_u *)path_shorten_fname((char *)file_path, ff_expand_buffer);
+ if (os_dirname((char_u *)ff_expand_buffer, MAXPATHL) == OK) {
+ p = path_shorten_fname(file_path, ff_expand_buffer);
if (p != NULL) {
STRMOVE(file_path, p);
}
@@ -830,7 +829,7 @@ char_u *vim_findfile(void *search_ctx_arg)
verbose_leave_scroll();
}
#endif
- return file_path;
+ return (char_u *)file_path;
}
// Not found or found already, try next suffix.
@@ -838,7 +837,7 @@ char_u *vim_findfile(void *search_ctx_arg)
break;
}
assert(MAXPATHL >= len);
- copy_option_part(&suf, (char *)file_path + len, MAXPATHL - len, ",");
+ copy_option_part(&suf, file_path + len, MAXPATHL - len, ",");
}
}
} else {
@@ -849,7 +848,7