mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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;
|
xp->xp_pattern_len = ccline.cmdpos - i;
|
||||||
|
|
||||||
if (type == WILD_NEXT || type == WILD_PREV) {
|
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);
|
p2 = ExpandOne(xp, NULL, NULL, 0, type);
|
||||||
} else {
|
} else {
|
||||||
/*
|
// Translate string into pattern and expand it.
|
||||||
* Translate string into pattern and expand it.
|
p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
|
||||||
*/
|
const int use_options = (
|
||||||
if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
|
options
|
||||||
xp->xp_context)) == NULL)
|
| WILD_HOME_REPLACE
|
||||||
p2 = NULL;
|
| WILD_ADD_SLASH
|
||||||
else {
|
| WILD_SILENT
|
||||||
int use_options = options |
|
| (escape ? WILD_ESCAPE : 0)
|
||||||
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT;
|
| (p_wic ? WILD_ICASE : 0));
|
||||||
if (escape)
|
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
|
||||||
use_options |= WILD_ESCAPE;
|
use_options, type);
|
||||||
|
xfree(p1);
|
||||||
if (p_wic)
|
// Longest match: make sure it is not shorter, happens with :help.
|
||||||
use_options += WILD_ICASE;
|
if (p2 != NULL && type == WILD_LONGEST) {
|
||||||
p2 = ExpandOne(xp, p1,
|
for (j = 0; j < xp->xp_pattern_len; j++) {
|
||||||
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
|
if (ccline.cmdbuff[i + j] == '*'
|
||||||
use_options, type);
|
|| ccline.cmdbuff[i + j] == '?') {
|
||||||
xfree(p1);
|
break;
|
||||||
/* 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((int)STRLEN(p2) < j) {
|
||||||
|
xfree(p2);
|
||||||
|
p2 = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user