aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r--src/nvim/path.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 0bb364184a..fd6cca63f4 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -92,15 +92,15 @@ FileComparison path_full_compare(char_u *const s1, char_u *const s2, const bool
///
/// @return pointer just past the last path separator (empty string, if fname
/// ends in a slash), or empty string if fname is NULL.
-char_u *path_tail(const char_u *fname)
+char *path_tail(const char *fname)
FUNC_ATTR_NONNULL_RET
{
if (fname == NULL) {
- return (char_u *)"";
+ return "";
}
- const char_u *tail = get_past_head(fname);
- const char_u *p = tail;
+ const char *tail = (char *)get_past_head((char_u *)fname);
+ const char *p = tail;
// Find last part of path.
while (*p != NUL) {
if (vim_ispathsep_nocolon(*p)) {
@@ -108,7 +108,7 @@ char_u *path_tail(const char_u *fname)
}
MB_PTR_ADV(p);
}
- return (char_u *)tail;
+ return (char *)tail;
}
/// Get pointer to tail of "fname", including path separators.
@@ -126,7 +126,7 @@ char_u *path_tail_with_sep(char_u *fname)
// Don't remove the '/' from "c:/file".
char_u *past_head = get_past_head(fname);
- char_u *tail = path_tail(fname);
+ char_u *tail = (char_u *)path_tail((char *)fname);
while (tail > past_head && after_pathsep((char *)fname, (char *)tail)) {
tail--;
}
@@ -275,7 +275,7 @@ int vim_ispathlistsep(int c)
/// It's done in-place.
void shorten_dir_len(char_u *str, int trim_len)
{
- char_u *tail = path_tail(str);
+ char_u *tail = (char_u *)path_tail((char *)str);
char_u *d = str;
bool skip = false;
int dirchunk_len = 0;
@@ -849,7 +849,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
if (curbuf->b_ffname == NULL) {
continue;
}
- char_u *p = path_tail(curbuf->b_ffname);
+ char_u *p = (char_u *)path_tail((char *)curbuf->b_ffname);
size_t len = (size_t)(p - curbuf->b_ffname);
if (len + STRLEN(buf) >= MAXPATHL) {
continue;
@@ -1375,17 +1375,18 @@ static int vim_backtick(char_u *p)
/// @param flags EW_* flags
static int expand_backtick(garray_T *gap, char_u *pat, int flags)
{
- char_u *p;
- char_u *buffer;
+ char *p;
+ char *buffer;
int cnt = 0;
// Create the command: lop off the backticks.
- char_u *cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
+ char *cmd = (char *)vim_strnsave(pat + 1, STRLEN(pat) - 2);
if (*cmd == '=') { // `={expr}`: Expand expression
- buffer = (char_u *)eval_to_string((char *)cmd + 1, (char **)&p, true);
+ buffer = eval_to_string(cmd + 1, &p, true);
} else {
- buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
+ buffer = (char *)get_cmd_output((char_u *)cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0,
+ NULL);
}
xfree(cmd);
if (buffer == NULL) {
@@ -1394,16 +1395,16 @@ static int expand_backtick(garray_T *gap, char_u *pat, int flags)
cmd = buffer;
while (*cmd != NUL) {
- cmd = (char_u *)skipwhite((char *)cmd); // skip over white space
+ cmd = skipwhite(cmd); // skip over white space
p = cmd;
while (*p != NUL && *p != '\r' && *p != '\n') { // skip over entry
++p;
}
// add an entry if it is not empty
if (p > cmd) {
- char_u i = *p;
+ char i = *p;
*p = NUL;
- addfile(gap, cmd, flags);
+ addfile(gap, (char_u *)cmd, flags);
*p = i;
++cnt;
}
@@ -2244,7 +2245,7 @@ int match_suffix(char_u *fname)
for (char_u *setsuf = p_su; *setsuf;) {
setsuflen = copy_option_part(&setsuf, suf_buf, MAXSUFLEN, ".,");
if (setsuflen == 0) {
- char_u *tail = path_tail(fname);
+ char_u *tail = (char_u *)path_tail((char *)fname);
// empty entry: match name without a '.'
if (vim_strchr(tail, '.') == NULL) {