Re: trim_common_tail bug?
- From
Jeff King <peff@peff.net>
- Date
- Dec 15, 2007, 20:02 UTC
- 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:
Show 10 quoted lines
> 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