Messages in this thread | | | Subject | Re: [for-next][PATCH 23/24] string.h: Add strncmp_prefix() helper macro | From | Joe Perches <> | Date | Sun, 23 Dec 2018 15:01:49 -0800 |
| |
On Sun, 2018-12-23 at 23:01 +0100, Rasmus Villemoes wrote: > On 21/12/2018 23.20, Joe Perches wrote: [] > > static inline bool str_has_prefix(const char *str, const char prefix[]) [] > We already have exactly that function, it's called strstarts().
Heh. Thanks Rasmus. I didn't remember that one.
I think the 'int str_has_prefix' naming and returning the prefix length may be a bit better use than 'bool strstarts' and perhaps a treewide conversion of the existing strstarts to str_has_prefix would be OK as there aren't that many.
$ git grep -w strstarts | wc -l 91
| |