Re: [PATCH 3/6] strbuf_getwholeline: use getc_unlocked

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

 



Jeff King <peff@xxxxxxxx> writes:

> So we'd have to either:
>
>   1. Decide that doesn't matter.
>
>   2. Have callers specify a "damn the NULs, I want it fast" flag.

The callers that used to call fgets and then later rewritten to
strbuf_getwholeline(), either of the above obviously should be OK,
and because the whole reason why we added strbuf_getline() interface
was to avoid having to repeatedly call fgets() and concatenate the
result if the fixed-size buffer we would give it is too small, I'd
say the callers that want to read lines terminated by LF and have NUL
as part of payload would be a tiny minority.

It depends on what we would find out after auditing all callers of
this function, but I would not be surprised if we decided #1 (i.e.
"this is about a _line_; what are you doing by having a NUL on
it?"), and the safest would be to do the inverse of #2, i.e. make it
fast by default and make oddball callers that care about NULs to
pass a flag.

Thanks for working on this.
--
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]