git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/7] commit: provide a function to find a header in a buffer

From
Jeff King <peff@peff.net>
Date
Jun 23, 2014, 16:47 UTC
Message-ID
<20140623164742.GA4838@sigill.intra.peff.net>
In-Reply-To
<CAPig+cQuBg0sjZXfkB7c_L=PMJuaPbWZBz9UV2Jbtr3eqJuPcw@mail.gmail.com>
On Sun, Jun 22, 2014 at 09:26:44PM -0400, Eric Sunshine wrote:
Show 17 quoted lines
> > +               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
Previous: Eric SunshineNext: Jeff King
Message 4 of 16 in “cleaning up determine_author_info”
  1. 0/7 cleaning up determine_author_infoJeff King, Jun 18, 2014
  2. 1/7 commit: provide a function to find a header in a bufferJeff King, Jun 18, 2014
  3. Eric SunshineJun 23, 2014
  4. Jeff KingJun 23, 2014
  5. 2/7 record_author_info: fix memory leak on malformed commitJeff King, Jun 18, 2014
  6. 3/7 record_author_info: use find_commit_headerJeff King, Jun 18, 2014
  7. 4/7 ident_split: store begin/end pairs on their own structJeff King, Jun 18, 2014
  8. Eric SunshineJun 23, 2014
  9. 5/7 use strbufs in date functionsJeff King, Jun 18, 2014
  10. 6/7 determine_author_info: reuse parsing functionsJeff King, Jun 18, 2014
  11. 7/7 determine_author_info: stop leaking name/emailJeff King, Jun 18, 2014
  12. Eric SunshineJun 23, 2014
  13. Erik Faye-LundJun 23, 2014
  14. Eric SunshineJun 23, 2014
  15. Jeff KingJun 23, 2014
  16. Jeff KingJun 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.