mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00
Test and refactor gettail -> path_tail.
This commit is contained in:

committed by
Thiago de Arruda

parent
6d712defa5
commit
77bfb6cd99
10
src/eval.c
10
src/eval.c
@@ -11691,7 +11691,7 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv)
|
||||
if (*dir == NUL)
|
||||
rettv->vval.v_number = FAIL;
|
||||
else {
|
||||
if (*gettail(dir) == NUL)
|
||||
if (*path_tail(dir) == NUL)
|
||||
/* remove trailing slashes */
|
||||
*gettail_sep(dir) = NUL;
|
||||
|
||||
@@ -12470,18 +12470,18 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
|
||||
q[-1] = NUL;
|
||||
}
|
||||
|
||||
q = gettail(p);
|
||||
q = path_tail(p);
|
||||
if (q > p && *q == NUL) {
|
||||
/* Ignore trailing path separator. */
|
||||
q[-1] = NUL;
|
||||
q = gettail(p);
|
||||
q = path_tail(p);
|
||||
}
|
||||
if (q > p && !os_is_absolute_path(buf)) {
|
||||
/* symlink is relative to directory of argument */
|
||||
cpy = alloc((unsigned)(STRLEN(p) + STRLEN(buf) + 1));
|
||||
if (cpy != NULL) {
|
||||
STRCPY(cpy, p);
|
||||
STRCPY(gettail(cpy), buf);
|
||||
STRCPY(path_tail(cpy), buf);
|
||||
vim_free(p);
|
||||
p = cpy;
|
||||
}
|
||||
@@ -19400,7 +19400,7 @@ repeat:
|
||||
}
|
||||
}
|
||||
|
||||
tail = gettail(*fnamep);
|
||||
tail = path_tail(*fnamep);
|
||||
*fnamelen = (int)STRLEN(*fnamep);
|
||||
|
||||
/* ":h" - head, remove "/file_name", can be repeated */
|
||||
|
Reference in New Issue
Block a user