Re: [PATCH 03/19] diff.c: drop 'nofirst' from emit_line_0

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

 



On Mon, May 15, 2017 at 11:33 AM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> On Mon, May 15, 2017 at 11:26 AM, Jonathan Tan <jonathantanmy@xxxxxxxxxx> wrote:
>> I also don't understand the meaning of this paragraph - if you mean that
>> this patch teaches other callers to hardcode the sign, I don't see any such
>> changes in the diff below.
>
> The last two hunks of the patch switch two callers that call with a sign
> that is hard to reason about.

The last two hunks don't hardcode any signs, as far as I can see. They
do pass in a "first" character that may or may not be a sign, if that
is what you mean.

In any case, can you reword that paragraph into an imperative
statement (e.g. "teach X to...", "make X...")?

>>> +                       char term[2];
>>> +                       term[0] = options->line_termination;
>>> +                       term[1] = '\0';
>>> +
>>> +                       emit_line(options, NULL, NULL,
>>> +                                 term, 1);
>>
>>
>> If options->line_termination is 0, this is actually a zero-length string
>> (not 1).
>
> So passing in !!options->line_termination should be fine?

Yes, that would work. I slightly prefer !!term[0].



[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]