Lines Matching defs:prefix
251 * strstarts - does @str start with @prefix?
253 * @prefix: prefix to look for.
255 static inline bool strstarts(const char *str, const char *prefix)
257 return strncmp(str, prefix, strlen(prefix)) == 0;
386 * str_has_prefix - Test if a string has a given prefix
388 * @prefix: The string to see if @str starts with
390 * A common way to test a prefix of a string is to do:
391 * strncmp(str, prefix, sizeof(prefix) - 1)
393 * But this can lead to bugs due to typos, or if prefix is a pointer
397 * * strlen(@prefix) if @str starts with @prefix
398 * * 0 if @str does not start with @prefix
400 static __always_inline size_t str_has_prefix(const char *str, const char *prefix)
402 size_t len = strlen(prefix);
403 return strncmp(str, prefix, len) == 0 ? len : 0;