From: Jeff King Date: Sat, 15 Dec 2007 20:02:02 GMT Subject: Re: trim_common_tail bug? Message-ID: <20071215200202.GA3334@sigill.intra.peff.net> In-Reply-To: <7vprx7n90t.fsf@gitster.siamese.dyndns.org> On Sat, Dec 15, 2007 at 09:49:06AM -0800, Junio C Hamano wrote: > Shoot. Thanks for spotting. > > Wouldn't it be enough to do: > > for (i = 0, recovered = 0; recovered < trimmed && i <= ctx; i++) { > while (recovered < trimmed && ap[recovered++] != '\n') > ; /* nothing */ > } > > then (warning: I haven't had my coffee yet)? Yes, I think that is equivalent. My sleep-deprived brain keeps thinking there must be a more clear way of writing this whole loop, but it escapes me at the moment. -Peff