From 4a6ab3494a93313841b7b701de4038519fabb0c9 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 8 Sep 2019 12:17:02 -0400 Subject: quickfix: fix pvs/v547 warning --- src/nvim/quickfix.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index e24ccc38b0..be6e48465f 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5139,9 +5139,7 @@ static int qf_setprop_context(qf_info_T *qi, int qf_idx, dictitem_T *di) { tv_free(qi->qf_lists[qf_idx].qf_ctx); typval_T *ctx = xcalloc(1, sizeof(typval_T)); - if (ctx != NULL) { - tv_copy(&di->di_tv, ctx); - } + tv_copy(&di->di_tv, ctx); qi->qf_lists[qf_idx].qf_ctx = ctx; return OK; -- cgit From f81619aafefc1e50b1121cc1c12577407a6eafff Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 8 Sep 2019 12:27:13 -0400 Subject: regexp: assert nonnull pointer for regnext() --- src/nvim/regexp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 06b99d0b75..37d71699dd 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -5522,6 +5522,7 @@ do_class: * there is an error. */ static char_u *regnext(char_u *p) + FUNC_ATTR_NONNULL_ALL { int offset; -- cgit From b8a338ee6a51c64e15ef3c66bcc67320e53cd6aa Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 8 Sep 2019 12:32:49 -0400 Subject: cursor_shape: check if modep is nonnull --- src/nvim/cursor_shape.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index 0377cb97e5..96ff1e5631 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -118,7 +118,6 @@ char_u *parse_shape_opt(int what) // Repeat for all modes before the colon. // For the 'a' mode, we loop to handle all the modes. all_idx = -1; - assert(modep < colonp); while (modep < colonp || all_idx >= 0) { if (all_idx < 0) { // Find the mode @@ -230,8 +229,9 @@ char_u *parse_shape_opt(int what) } } modep = p; - if (*modep == ',') - ++modep; + if (modep != NULL && *modep == ',') { + modep++; + } } } -- cgit From 2ed7cda8cd0fe7dd29fa7879a7bf6df9256d38cd Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 8 Sep 2019 12:35:50 -0400 Subject: spell: assert nonull pointers --- src/nvim/spell.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 40bb882948..760ac2e6c1 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2305,6 +2305,7 @@ static int find_region(char_u *rp, char_u *region) /// /// @returns Case type of word int captype(char_u *word, char_u *end) + FUNC_ATTR_NONNULL_ARG(1) { char_u *p; int c; @@ -2355,6 +2356,7 @@ int captype(char_u *word, char_u *end) // capital. So that make_case_word() can turn WOrd into Word. // Add ALLCAP for "WOrD". static int badword_captype(char_u *word, char_u *end) + FUNC_ATTR_NONNULL_ALL { int flags = captype(word, end); int c; -- cgit