Cleaned up boolean apply code.

This commit is contained in:
Jan Vidar Krey 2010-08-30 11:57:41 +02:00
parent 21c22288a2
commit a934dfaa70
1 changed files with 1 additions and 11 deletions

View File

@ -31,17 +31,7 @@
static int apply_boolean(const char* key, const char* data, int* target)
{
if (strlen(data) == 1 && (data[0] == '1')) *target = 1;
else if (strlen(data) == 1 && (data[0] == '0')) *target = 0;
else if (strncasecmp(data, "true", 4) == 0) *target = 1;
else if (strncasecmp(data, "false", 5) == 0) *target = 0;
else if (strncasecmp(data, "yes", 3) == 0) *target = 1;
else if (strncasecmp(data, "no", 2) == 0) *target = 0;
else if (strncasecmp(data, "on", 2) == 0) *target = 1;
else if (strncasecmp(data, "off", 3) == 0) *target = 0;
else
return 0;
return 1;
return string_to_boolean(data, target);
}
static int apply_string(const char* key, const char* data, char** target, char* regexp)