From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 1/7] commit: provide a function to find a header in a buffer
Date: Mon, 23 Jun 2014 12:47:42 -0400 [thread overview]
Message-ID: <20140623164742.GA4838@sigill.intra.peff.net> (raw)
In-Reply-To: <CAPig+cQuBg0sjZXfkB7c_L=PMJuaPbWZBz9UV2Jbtr3eqJuPcw@mail.gmail.com>
On Sun, Jun 22, 2014 at 09:26:44PM -0400, Eric Sunshine wrote:
> > + if (line == eol)
> > + return NULL;
> > + next = *eol ? eol + 1 : NULL;
> > +
> > + if (eol - line > key_len &&
> > + !strncmp(line, key, key_len) &&
> > + line[key_len] == ' ') {
> > + *out_len = eol - line - key_len - 1;
> > + return line + key_len + 1;
> > + }
> > + line = next;
>
> This is already simplified from the original implementation in
> get_header(), but it can be simplified further by dropping 'next',
> which is not otherwise used, and assigning 'line' directly:
>
> line = *eol ? eol + 1 : NULL;
Yeah, you're right. Squashed, thanks.
-Peff
next prev parent reply other threads:[~2014-06-23 16:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 20:19 [PATCH 0/7] cleaning up determine_author_info Jeff King
2014-06-18 20:27 ` [PATCH 1/7] commit: provide a function to find a header in a buffer Jeff King
2014-06-23 1:26 ` Eric Sunshine
2014-06-23 16:47 ` Jeff King [this message]
2014-06-18 20:28 ` [PATCH 2/7] record_author_info: fix memory leak on malformed commit Jeff King
2014-06-18 20:29 ` [PATCH 3/7] record_author_info: use find_commit_header Jeff King
2014-06-18 20:31 ` [PATCH 4/7] ident_split: store begin/end pairs on their own struct Jeff King
2014-06-23 1:28 ` Eric Sunshine
2014-06-18 20:32 ` [PATCH 5/7] use strbufs in date functions Jeff King
2014-06-18 20:35 ` [PATCH 6/7] determine_author_info: reuse parsing functions Jeff King
2014-06-18 20:36 ` [PATCH 7/7] determine_author_info: stop leaking name/email Jeff King
2014-06-23 9:28 ` Eric Sunshine
2014-06-23 9:33 ` Erik Faye-Lund
2014-06-23 9:48 ` Eric Sunshine
2014-06-23 17:21 ` Jeff King
2014-06-23 17:20 ` Jeff King
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=20140623164742.GA4838@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=sunshine@sunshineco.com \
/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).