utils: Add helper function to check a string for a given prefix
This commit is contained in:
1 parent
985dcab1c2
commit
f460facdca
1 file changed
+8
@@ -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