Re: [PATCH v2 02/12] attr.c: use strchrnul() to scan for one line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 16, 2016 at 4:28 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
>>         for (sp = buf; *sp; ) {
>>                 char *ep;
>>                 int more;
>> -               for (ep = sp; *ep && *ep != '\n'; ep++)
>> -                       ;
>> +
>> +               ep = strchrnul(sp, '\n');
>
> (Even lesser nit as in patch 1)
> You could directly assign ep and more when declaring them.

I'd prefer not to.

"A declaration block, blank and statement" pattern allows you
to have the declaration of variables to group related things
together and in an order that makes it easier to explain.
If you throw in initialization there, you cannot do that anymore
(e.g. ep must be initialized before you can compute more).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]