Re: git segfault in tag verify (patch included)
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 16, 2019, 19:17 UTC
- Message-ID
- <xmqqk1ch3i1s.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190716185835.GA24468@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 9 quoted lines
> Something like:
>
> for (line = buf; *line; line = next) {
> next = strchrnul(line, '\n');
>
> ... do stuff ...
> /* find a space within the line */
> space = memchr(line, ' ', next - line);
> }I am not sure about the memchr() thing, but "prepare next that is constant thru the iteration, and update line to it at the end of each iteration" is a robust pattern to follow. I like it.