From 8ee09a3bd27a61740c366d8b4373e1f19191840c Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Sun, 26 Apr 2015 11:40:29 +0200 Subject: Fix warnings: ex_getln.c: init_history(): Nonnull attr passed null: HI. Problem : Argument with 'nonnull' attribute passed null @ 4227. Diagnostic : Harmless issue. Rationale : It's true we're calling memset with NULL pointer, but it's also true we're doing it with zero size. We just thought that would work and do nothing (it was a way of avoiding to add a guard). It doesn't work, though, as memset requires nonnull arguments. Resolution : Add guard to avoid null argument. --- src/nvim/ex_getln.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 65d6dd676f..c7cb0c7294 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4239,7 +4239,9 @@ void init_history(void) // clear remaining space, if any int l3 = j < 0 ? 0 : MIN(newlen, oldlen); // number of copied entries - memset(temp + l3, 0, (size_t)(newlen - l3) * sizeof(*temp)); + if (newlen) { + memset(temp + l3, 0, (size_t)(newlen - l3) * sizeof(*temp)); + } hisidx[type] = l3 - 1; xfree(history[type]); -- cgit From 46f510350eed7cc3b7c5254daaaeb0ae355e4eee Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Mon, 27 Apr 2015 19:50:33 +0200 Subject: Fix warnings: ex_getln.c: getexmodeline(): HI. Problem : Dead increment @ 1795. Diagnostic : Harmless issue. Rationale : Line was necessary before (indent was used by the following while loop), but now that loop is removed, assignment is indeed dead. Resolution : Remove line. --- src/nvim/ex_getln.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index c7cb0c7294..b54ae5fe11 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1792,7 +1792,6 @@ getexmodeline ( p[line_ga.ga_len] = NUL; indent = get_indent_str(p, 8, FALSE); num_spaces = sw - indent % sw; - indent += num_spaces; add_indent: if (num_spaces > 0) { ga_grow(&line_ga, num_spaces + 1); -- cgit