linuxkpi: Add str_has_prefix
This function test if the string str begins with the string pointed at by prefix. Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23767
This commit is contained in:
parent
8f0c734385
commit
1a7ba9a01c
@ -154,4 +154,13 @@ memchr_inv(const void *start, int c, size_t length)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
str_has_prefix(const char *str, const char *prefix)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strlen(prefix);
|
||||
return (strncmp(str, prefix, len) == 0 ? len : 0);
|
||||
}
|
||||
|
||||
#endif /* _LINUX_STRING_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user