From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Steven Roberts <fenderq@gmail.com>, git@vger.kernel.org
Subject: Re: git segfault in tag verify (patch included)
Date: Tue, 16 Jul 2019 12:17:51 -0700 [thread overview]
Message-ID: <xmqqk1ch3i1s.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190716185835.GA24468@sigill.intra.peff.net> (Jeff King's message of "Tue, 16 Jul 2019 14:58:35 -0400")
Jeff King <peff@peff.net> 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.
prev parent reply other threads:[~2019-07-16 19:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-16 17:47 git segfault in tag verify (patch included) Steven Roberts
2019-07-16 18:20 ` Junio C Hamano
2019-07-16 18:47 ` Steven Roberts
2019-07-16 18:58 ` Jeff King
2019-07-16 19:17 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqk1ch3i1s.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=fenderq@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).