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)
{
FILE *dhcpd_config;
int newclause = true, argument = false, comment =
false, braces = 0, quote = false;
bool newclause = true, comment = false;
int quote = 0, braces = 0, argument = 0;
size_t i = 0;
char *word, c;
int braces_shared = 1000;
@ -304,7 +304,7 @@ void parse_config(int is_include, const char *restrict config_file,
break;
case ';':
/* Quoted colon does not mean new clause */
if (quote == true) {
if (0 < quote) {
break;
}
if (comment == false && argument != 2 && argument != 4) {
@ -321,10 +321,10 @@ void parse_config(int is_include, const char *restrict config_file,
}
continue;
case '{':
if (quote == true) {
if (0 < quote) {
break;
}
if (comment == false) {
if (comment == 0) {
braces++;
}
/* 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;
}
case '}':
if (quote == true) {
if (0 < quote) {
break;
}
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. */
if ((newclause == true || argument != 0)
&& (!isspace(c) || quote == true)) {
&& (!isspace(c) || 0 < quote)) {
word[i] = c;
i++;
/* Long word which is almost causing overflow. None