From: Junio C Hamano Date: Tue, 16 Jul 2019 19:17:51 GMT Subject: Re: git segfault in tag verify (patch included) Message-ID: In-Reply-To: <20190716185835.GA24468@sigill.intra.peff.net> Jeff King writes: > 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.