moved strcaseeq() macro from constants.h to utils.h

This commit is contained in:
Andreas Steffen
2009-04-17 09:52:49 +00:00
parent 2775c9aac8
commit 63176bbcb0
6 changed files with 92 additions and 41 deletions
+8 -8
View File
@@ -214,17 +214,17 @@ static bool get_bool(private_settings_t *this, char *key, bool def, ...)
va_end(args);
if (value)
{
if (strcasecmp(value, "true") == 0 ||
strcasecmp(value, "enabled") == 0 ||
strcasecmp(value, "yes") == 0 ||
strcasecmp(value, "1") == 0)
if (strcaseeq(value, "true") ||
strcaseeq(value, "enabled") ||
strcaseeq(value, "yes") ||
strcaseeq(value, "1"))
{
return TRUE;
}
else if (strcasecmp(value, "false") == 0 ||
strcasecmp(value, "disabled") == 0 ||
strcasecmp(value, "no") == 0 ||
strcasecmp(value, "0") == 0)
else if (strcaseeq(value, "false") ||
strcaseeq(value, "disabled") ||
strcaseeq(value, "no") ||
strcaseeq(value, "0"))
{
return FALSE;
}
+5
View File
@@ -50,6 +50,11 @@
*/
#define strneq(x,y,len) (strncmp(x, y, len) == 0)
/**
* Macro compares two strings for equality ignoring case
*/
#define strcaseeq(x,y) (strcasecmp(x, y) == 0)
/**
* Macro compares two binary blobs for equality
*/