mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
ex_getln: Fix PVS/V547: function is stated to never return NULL
This commit is contained in:
parent
c90e9df5b5
commit
469ba2fb49
@ -3590,40 +3590,33 @@ nextwild (
|
||||
xp->xp_pattern_len = ccline.cmdpos - i;
|
||||
|
||||
if (type == WILD_NEXT || type == WILD_PREV) {
|
||||
/*
|
||||
* Get next/previous match for a previous expanded pattern.
|
||||
*/
|
||||
// Get next/previous match for a previous expanded pattern.
|
||||
p2 = ExpandOne(xp, NULL, NULL, 0, type);
|
||||
} else {
|
||||
/*
|
||||
* Translate string into pattern and expand it.
|
||||
*/
|
||||
if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
|
||||
xp->xp_context)) == NULL)
|
||||
p2 = NULL;
|
||||
else {
|
||||
int use_options = options |
|
||||
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT;
|
||||
if (escape)
|
||||
use_options |= WILD_ESCAPE;
|
||||
|
||||
if (p_wic)
|
||||
use_options += WILD_ICASE;
|
||||
p2 = ExpandOne(xp, p1,
|
||||
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
|
||||
use_options, type);
|
||||
xfree(p1);
|
||||
/* longest match: make sure it is not shorter, happens with :help */
|
||||
if (p2 != NULL && type == WILD_LONGEST) {
|
||||
for (j = 0; j < xp->xp_pattern_len; ++j)
|
||||
if (ccline.cmdbuff[i + j] == '*'
|
||||
|| ccline.cmdbuff[i + j] == '?')
|
||||
break;
|
||||
if ((int)STRLEN(p2) < j) {
|
||||
xfree(p2);
|
||||
p2 = NULL;
|
||||
// Translate string into pattern and expand it.
|
||||
p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||
const int use_options = (
|
||||
options
|
||||
| WILD_HOME_REPLACE
|
||||
| WILD_ADD_SLASH
|
||||
| WILD_SILENT
|
||||
| (escape ? WILD_ESCAPE : 0)
|
||||
| (p_wic ? WILD_ICASE : 0));
|
||||
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
|
||||
use_options, type);
|
||||
xfree(p1);
|
||||
// Longest match: make sure it is not shorter, happens with :help.
|
||||
if (p2 != NULL && type == WILD_LONGEST) {
|
||||
for (j = 0; j < xp->xp_pattern_len; j++) {
|
||||
if (ccline.cmdbuff[i + j] == '*'
|
||||
|| ccline.cmdbuff[i + j] == '?') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((int)STRLEN(p2) < j) {
|
||||
xfree(p2);
|
||||
p2 = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user