mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
Remove nonnullret deadcode: vim_strsave.
This commit is contained in:
@@ -239,33 +239,31 @@ int vim_ispathlistsep(int c)
|
||||
* Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
|
||||
* It's done in-place.
|
||||
*/
|
||||
void shorten_dir(char_u *str)
|
||||
char_u *shorten_dir(char_u *str)
|
||||
{
|
||||
char_u *tail, *s, *d;
|
||||
int skip = FALSE;
|
||||
|
||||
tail = path_tail(str);
|
||||
d = str;
|
||||
for (s = str;; ++s) {
|
||||
char_u *tail = path_tail(str);
|
||||
char_u *d = str;
|
||||
bool skip = false;
|
||||
for (char_u *s = str;; ++s) {
|
||||
if (s >= tail) { /* copy the whole tail */
|
||||
*d++ = *s;
|
||||
if (*s == NUL)
|
||||
break;
|
||||
} else if (vim_ispathsep(*s)) { /* copy '/' and next char */
|
||||
*d++ = *s;
|
||||
skip = FALSE;
|
||||
skip = false;
|
||||
} else if (!skip) {
|
||||
*d++ = *s; /* copy next char */
|
||||
if (*s != '~' && *s != '.') /* and leading "~" and "." */
|
||||
skip = TRUE;
|
||||
skip = true;
|
||||
if (has_mbyte) {
|
||||
int l = mb_ptr2len(s);
|
||||
|
||||
while (--l > 0)
|
||||
*d++ = *++s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user