From: Junio C Hamano Date: Sun, 05 Apr 2015 20:09:24 GMT Subject: Re: [PATCH 3/6] strbuf_getwholeline: use getc_unlocked Message-ID: In-Reply-To: <20150405045614.GA12053@peff.net> Jeff King 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.