diff options
author | Rosen Penev <rosenp@gmail.com> | 2016-12-17 16:48:47 -0800 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2016-12-19 09:32:45 +0100 |
commit | 8488bb5bfdaf6ab4771622c57a62aad5fd491f06 (patch) | |
tree | 363fb781c3facc2416d59ef29e2672a426e9faa3 /validate | |
parent | db070f15ac559e3bd406cb8b8cccf40f78e75094 (diff) | |
download | ubox-8488bb5bfdaf6ab4771622c57a62aad5fd491f06.tar.gz |
ubox: Initialize conditionally uninitialized variabled
fixes false positive warning from "-Wconditional-uninitialized in clang"
Signed-off by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'validate')
-rw-r--r-- | validate/validate.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/validate/validate.c b/validate/validate.c index 0628407..e72b811 100644 --- a/validate/validate.c +++ b/validate/validate.c @@ -200,7 +200,8 @@ dt_type_list(struct dt_state *s, int nargs) static bool dt_type_min(struct dt_state *s, int nargs) { - int n, min; + int n; + int min = 0; char *e; if (dt_getint(0, min)) @@ -215,7 +216,8 @@ dt_type_min(struct dt_state *s, int nargs) static bool dt_type_max(struct dt_state *s, int nargs) { - int n, max; + int n; + int max = 0; char *e; if (dt_getint(0, max)) @@ -230,7 +232,9 @@ dt_type_max(struct dt_state *s, int nargs) static bool dt_type_range(struct dt_state *s, int nargs) { - int n, min, max; + int n; + int min = 0; + int max = 0; char *e; if (dt_getint(0, min) && dt_getint(1, max)) @@ -245,7 +249,7 @@ dt_type_range(struct dt_state *s, int nargs) static bool dt_type_minlen(struct dt_state *s, int nargs) { - int min; + int min = 0; if (dt_getint(0, min)) return (strlen(s->value) >= min); @@ -256,7 +260,7 @@ dt_type_minlen(struct dt_state *s, int nargs) static bool dt_type_maxlen(struct dt_state *s, int nargs) { - int max; + int max = 0; if (dt_getint(0, max)) return (strlen(s->value) <= max); @@ -267,7 +271,8 @@ dt_type_maxlen(struct dt_state *s, int nargs) static bool dt_type_rangelen(struct dt_state *s, int nargs) { - int min, max; + int min = 0; + int max = 0; int len = strlen(s->value); if (dt_getint(0, min) && dt_getint(1, max)) @@ -346,7 +351,8 @@ dt_type_bool(struct dt_state *s, int nargs) static bool dt_type_string(struct dt_state *s, int nargs) { - int min, max; + int min = 0; + int max = 0; int len = strlen(s->value); if (dt_getint(0, min) && (len < min)) @@ -361,7 +367,8 @@ dt_type_string(struct dt_state *s, int nargs) static bool dt_type_hexstring(struct dt_state *s, int nargs) { - int min, max; + int min = 0; + int max = 0; int len = strlen(s->value); const char *p; |