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.
This commit is contained in:
ZyX
2017-05-20 04:08:41 +03:00
parent 9ec2bf26ce
commit 40444e9186

View File

@@ -656,8 +656,9 @@ void getout(int exitval)
/// ///
/// @return argument's numeric value otherwise /// @return argument's numeric value otherwise
static int get_number_arg(const char *p, int *idx, int def) 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])); def = atoi(&(p[*idx]));
while (ascii_isdigit(p[*idx])) { while (ascii_isdigit(p[*idx])) {
*idx = *idx + 1; *idx = *idx + 1;