utils: Add case-insensitive version of strpfx()

This commit is contained in:
Tobias Brunner
2013-08-24 16:22:51 +02:00
committed by Andreas Steffen
parent 49032d15be
commit 32a145fdbd
2 changed files with 44 additions and 0 deletions
+8
View File
@@ -112,6 +112,14 @@ static inline bool strncaseeq(const char *x, const char *y, size_t len)
return strncasecmp(x, y, len) == 0;
}
/**
* Helper function that checks if a string starts with a given prefix
*/
static inline bool strcasepfx(const char *x, const char *prefix)
{
return strncaseeq(x, prefix, strlen(prefix));
}
/**
* NULL-safe strdup variant
*/