Re: [PATCH] linux/string.h: Introduce streq macro.

From: Geert Uytterhoeven
Date: Wed Apr 27 2011 - 04:42:21 EST


On Wed, Apr 27, 2011 at 10:29, Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
> On Tue, Apr 26, 2011 at 9:58 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> On Tue, 2011-04-26 at 16:47 -0300, Thiago Farina wrote:
>>
>>> > $ grep -rP --include=*.[ch] "\bstrcmp.*==\s*0\b" * | wc -l
>>> > 1143
>>> > $ grep -rP --include=*.[ch] "\!\s*strcmp\s*\(" * Â| wc -l
>>> > 1663
>>> >
>>> > Can you count how many misuses of strcmp have been
>>> > corrected?
>>>
>>> > Do you plan to convert the existing 2800?
>>>
>>> I'd work on this without any problem.
>>
>> Nothing a perl script can't do either.
>
> If you are really going to do that, please use a coccinelle's semantic
> patch (which is designed precisely for that purpose) and document it
> so that it can be included in the standard set of semantic patches
> applied to the kernel regularly, i.e. something like:

First, I agree (mildly) with the opponents: strcmp() is standard C99.
Second, as the goal is to avoid bugs, this conversion should not be blindly
done by a script and be done with it, but reviewed by a human.

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/