From 40444e9186a7d3666930de4abfb4662e603d1f06 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 20 May 2017 04:08:41 +0300 Subject: main: Silence V522: potential NULL pointer dereference AFAIK there is no way NULL can be there, including from the line it points to. Dunno what analyser was thinking, but dereferencing of `argv[0]` happened just before `get_number_arg()` call: in `ascii_isdigit()` two lines above. And `idx` cannot possibly be NULL ever, it comes from `&varname`, this could not ever give anything, but a valid pointer. --- src/nvim/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvim/main.c b/src/nvim/main.c index a37fefc648..46607da6ea 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -656,8 +656,9 @@ void getout(int exitval) /// /// @return argument's numeric value otherwise static int get_number_arg(const char *p, int *idx, int def) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { - if (ascii_isdigit(p[*idx])) { + if (ascii_isdigit(p[*idx])) { // -V522 def = atoi(&(p[*idx])); while (ascii_isdigit(p[*idx])) { *idx = *idx + 1; -- cgit