utils: Add helper function to check a string for a given prefix
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user