aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2018-04-15 19:38:22 +0300
committerZyX <kp-pav@yandex.ru>2018-04-15 20:07:07 +0300
commitc90e9df5b572578a64120f95f08288e30079b861 (patch)
treed73d9912566c9812324efb1e7c53c220e92e57bc /src
parentcad616c94ecf94a2abd959e3c09886c00c5afb3f (diff)
downloadrneovim-c90e9df5b572578a64120f95f08288e30079b861.tar.gz
rneovim-c90e9df5b572578a64120f95f08288e30079b861.tar.bz2
rneovim-c90e9df5b572578a64120f95f08288e30079b861.zip
ex_getln: Fix PVS/V560: there are no longer NULL returns for OOM
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 698419405a..35454ba316 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4856,23 +4856,27 @@ void ExpandGeneric(
// copy the matching names into allocated memory
count = 0;
- for (i = 0;; ++i) {
+ for (i = 0;; i++) {
str = (*func)(xp, i);
- if (str == NULL) // end of list
+ if (str == NULL) { // end of list
break;
- if (*str == NUL) // skip empty strings
+ }
+ if (*str == NUL) { // skip empty strings
continue;
+ }
if (vim_regexec(regmatch, str, (colnr_T)0)) {
- if (escaped)
+ if (escaped) {
str = vim_strsave_escaped(str, (char_u *)" \t\\.");
- else
+ } else {
str = vim_strsave(str);
+ }
(*file)[count++] = str;
- if (func == get_menu_names && str != NULL) {
- /* test for separator added by get_menu_names() */
+ if (func == get_menu_names) {
+ // Test for separator added by get_menu_names().
str += STRLEN(str) - 1;
- if (*str == '\001')
+ if (*str == '\001') {
*str = '.';
+ }
}
}
}