Re: [for-next][PATCH 23/24] string.h: Add strncmp_prefix() helper macro

From: Steven Rostedt
Date: Fri Dec 21 2018 - 17:58:49 EST


On Fri, 21 Dec 2018 14:29:30 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Fri, Dec 21, 2018 at 2:20 PM Joe Perches <joe@xxxxxxxxxxx> wrote:
> >
> > Using
> >
> > static inline bool str_has_prefix(const char *str, const char prefix[])
> > {
> > return !strncmp(str, prefix, strlen(prefix));
> > }
> >
> > eliminates the strlen with gcc 4.8 (oldest I still have)
>
> Ok, that looks like the right thing to do.
>

Agreed, and I posted a new version. I can start running it through my
test suit (I'll update all the instances in the tracing directory to
use it), and then it will be ready for a pull request by next week.

I'll revert the top two patches from my for-next tree now.

-- Steve