Re: [PATCH v2 01/12] commit.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:41 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> On Mon, May 16, 2016 at 4:19 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
>>>         if (*p) {
>>>                 p += 2;
>>> -               for (eol = p; *eol && *eol != '\n'; eol++)
>>> -                       ; /* do nothing */
>>> +               eol = strchrnul(p, '\n');
>>
>> Nit:
>> You could include the +2 into the arg of  strchrnul,
>> such that you can drop the braces.
>
> You're right. With or without braces,
>
>   eol = strchrnul(p + 2, '\n');
>
> would be easier to understand (I do not know offhand if the value of p
> matters after this part, as I am responding from GMail Web UI without
> access to the wider context in the source, though).

Heh, good point, I did not think it through apparently. `p` matters.
--
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]