On Wed, 19 Dec 2018 12:51:59 -0800
Joe Perches <j...@perches.com> wrote:


> > #define strncmp_prefix(str, prefix) \
> >     strncmp(str, prefix, strlen(prefix))
> > 
> > in include/linux/string.h
> > 
> > And go around and use that throughout the kernel. By doing a quick
> > grep, I already spotted a few bugs.  
> 
> I hope you also convert the existing uses like
> 
>       strncmp(str1, "str2", 4)
> 
> where the length value is precalculated to the strlen
> of the const string

Yeah sure.

> 
> But there seem to be _a lot_ of those...
> 
> $ git grep -P "\bstrncmp\s*\([^,]+,[^,]+,\s*\d+\s*\)" | wc -l
> 1681
> 

Right.

I'm going to first create the macro and probably just apply it to the
tracing directory. Then when the macro is added to the next merge
window, I'll post a bunch of patches that clean up the rest of the code.

-- Steve

Reply via email to