mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
Remove nonnullret deadcode: Mark new nonnullret functions.
This commit is contained in:
@@ -3265,6 +3265,7 @@ addstar (
|
||||
int len,
|
||||
int context /* EXPAND_FILES etc. */
|
||||
)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
char_u *retval;
|
||||
int i, j;
|
||||
@@ -3343,35 +3344,33 @@ addstar (
|
||||
}
|
||||
} else {
|
||||
retval = xmalloc(len + 4);
|
||||
if (retval != NULL) {
|
||||
STRLCPY(retval, fname, len + 1);
|
||||
STRLCPY(retval, fname, len + 1);
|
||||
|
||||
/*
|
||||
* Don't add a star to *, ~, ~user, $var or `cmd`.
|
||||
* * would become **, which walks the whole tree.
|
||||
* ~ would be at the start of the file name, but not the tail.
|
||||
* $ could be anywhere in the tail.
|
||||
* ` could be anywhere in the file name.
|
||||
* When the name ends in '$' don't add a star, remove the '$'.
|
||||
*/
|
||||
tail = path_tail(retval);
|
||||
ends_in_star = (len > 0 && retval[len - 1] == '*');
|
||||
/*
|
||||
* Don't add a star to *, ~, ~user, $var or `cmd`.
|
||||
* * would become **, which walks the whole tree.
|
||||
* ~ would be at the start of the file name, but not the tail.
|
||||
* $ could be anywhere in the tail.
|
||||
* ` could be anywhere in the file name.
|
||||
* When the name ends in '$' don't add a star, remove the '$'.
|
||||
*/
|
||||
tail = path_tail(retval);
|
||||
ends_in_star = (len > 0 && retval[len - 1] == '*');
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
for (i = len - 2; i >= 0; --i) {
|
||||
if (retval[i] != '\\')
|
||||
break;
|
||||
ends_in_star = !ends_in_star;
|
||||
}
|
||||
#endif
|
||||
if ((*retval != '~' || tail != retval)
|
||||
&& !ends_in_star
|
||||
&& vim_strchr(tail, '$') == NULL
|
||||
&& vim_strchr(retval, '`') == NULL)
|
||||
retval[len++] = '*';
|
||||
else if (len > 0 && retval[len - 1] == '$')
|
||||
--len;
|
||||
retval[len] = NUL;
|
||||
for (i = len - 2; i >= 0; --i) {
|
||||
if (retval[i] != '\\')
|
||||
break;
|
||||
ends_in_star = !ends_in_star;
|
||||
}
|
||||
#endif
|
||||
if ((*retval != '~' || tail != retval)
|
||||
&& !ends_in_star
|
||||
&& vim_strchr(tail, '$') == NULL
|
||||
&& vim_strchr(retval, '`') == NULL)
|
||||
retval[len++] = '*';
|
||||
else if (len > 0 && retval[len - 1] == '$')
|
||||
--len;
|
||||
retval[len] = NUL;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user