From: Sami Kerola Date: Sun, 1 Jan 2017 19:25:24 +0000 (+0000) Subject: smatch: fix couple warnings X-Git-Tag: v0.88~9^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67db88c0876fe55c1b232d379755a502324f44f;p=thirdparty%2Fmtr.git smatch: fix couple warnings ui/mtr.c:616:21: warning: Using plain integer as NULL pointer packet/cmdparse.c:80:18: warning: Variable length array is used. Signed-off-by: Sami Kerola --- diff --git a/packet/cmdparse.c b/packet/cmdparse.c index 6c1d16a..e01b03f 100644 --- a/packet/cmdparse.c +++ b/packet/cmdparse.c @@ -76,15 +76,14 @@ int parse_command( struct command_t *command, char *command_string) { - const int max_tokens = MAX_COMMAND_ARGUMENTS * 2 + 2; - char *tokens[max_tokens]; + char *tokens[MAX_COMMAND_TOKENS]; int token_count; int i; memset(command, 0, sizeof(struct command_t)); /* Tokenize the string using whitespace */ - token_count = tokenize_command(tokens, max_tokens, command_string); + token_count = tokenize_command(tokens, MAX_COMMAND_TOKENS, command_string); if (token_count < 2) { errno = EINVAL; return -1; diff --git a/packet/cmdparse.h b/packet/cmdparse.h index aae1fe3..9b9c390 100644 --- a/packet/cmdparse.h +++ b/packet/cmdparse.h @@ -19,7 +19,10 @@ #ifndef CMDPARSE_H #define CMDPARSE_H -#define MAX_COMMAND_ARGUMENTS 16 +enum { + MAX_COMMAND_ARGUMENTS = 16, + MAX_COMMAND_TOKENS = MAX_COMMAND_ARGUMENTS * 2 + 2 +}; /* Parsed commands, or command replies, ready for semantic interpretation */ struct command_t diff --git a/ui/mtr.c b/ui/mtr.c index c635aec..da1e32d 100644 --- a/ui/mtr.c +++ b/ui/mtr.c @@ -613,7 +613,7 @@ static void init_rand(void) { struct timeval tv; - gettimeofday(&tv, 0); + gettimeofday(&tv, NULL); srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); }