Test and refactor gettail -> path_tail.

This commit is contained in:
Thomas Wienecke
2014-03-30 13:42:03 +02:00
committed by Thiago de Arruda
parent 6d712defa5
commit 77bfb6cd99
22 changed files with 99 additions and 79 deletions

View File

@@ -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 */