getdata: do not mix boolean and int data types [cppcheck]

[src/getdata.c:307]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:324]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:340]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:362]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:366]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:371]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:372]: (warning) Comparison of a boolean with integer that is neither 1 nor 0
[src/getdata.c:385]: (warning) Comparison of a boolean with integer that is neither 1 nor 0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2012-02-05 22:38:44 +01:00
parent c5b12e4368
commit 97e5b59b78

View file

@ -244,8 +244,8 @@ void parse_config(int is_include, const char *restrict config_file,
struct shared_network_t *restrict shared_p) struct shared_network_t *restrict shared_p)
{ {
FILE *dhcpd_config; FILE *dhcpd_config;
int newclause = true, argument = false, comment = bool newclause = true, comment = false;
false, braces = 0, quote = false; int quote = 0, braces = 0, argument = 0;
size_t i = 0; size_t i = 0;
char *word, c; char *word, c;
int braces_shared = 1000; int braces_shared = 1000;
@ -304,7 +304,7 @@ void parse_config(int is_include, const char *restrict config_file,
break; break;
case ';': case ';':
/* Quoted colon does not mean new clause */ /* Quoted colon does not mean new clause */
if (quote == true) { if (0 < quote) {
break; break;
} }
if (comment == false && argument != 2 && argument != 4) { if (comment == false && argument != 2 && argument != 4) {
@ -321,10 +321,10 @@ void parse_config(int is_include, const char *restrict config_file,
} }
continue; continue;
case '{': case '{':
if (quote == true) { if (0 < quote) {
break; break;
} }
if (comment == false) { if (comment == 0) {
braces++; braces++;
} }
/* i == 0 detects word that ends to brace like: /* i == 0 detects word that ends to brace like:
@ -337,7 +337,7 @@ void parse_config(int is_include, const char *restrict config_file,
break; break;
} }
case '}': case '}':
if (quote == true) { if (0 < quote) {
break; break;
} }
if (comment == false) { if (comment == false) {
@ -369,7 +369,7 @@ void parse_config(int is_include, const char *restrict config_file,
} }
/* Save to word which clause this is. */ /* Save to word which clause this is. */
if ((newclause == true || argument != 0) if ((newclause == true || argument != 0)
&& (!isspace(c) || quote == true)) { && (!isspace(c) || 0 < quote)) {
word[i] = c; word[i] = c;
i++; i++;
/* Long word which is almost causing overflow. None /* Long word which is almost causing overflow. None