utils: Add helper function to check a string for a given prefix

This commit is contained in:
Tobias Brunner
2013-07-08 18:49:30 +02:00
parent 985dcab1c2
commit f460facdca
+8
View File
@@ -88,6 +88,14 @@ static inline bool strneq(const char *x, const char *y, size_t len)
return strncmp(x, y, len) == 0;
}
/**
* Helper function that checks if a string starts with a given prefix
*/
static inline bool strpfx(const char *x, const char *prefix)
{
return strneq(x, prefix, strlen(prefix));
}
/**
* Helper function that compares two strings for equality ignoring case
*/