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

2014-06-23 Thread Jeff King
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) +

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

2014-06-22 Thread Eric Sunshine
On Wednesday, June 18, 2014, Jeff King p...@peff.net wrote: Usually when we parse a commit, we read it line by line and handle each header in a single pass (e.g., in parse_commit and parse_commit_header). Sometimes, however, we only care about extracting a single header. Code in this

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

2014-06-18 Thread Jeff King
Usually when we parse a commit, we read it line by line and handle each header in a single pass (e.g., in parse_commit and parse_commit_header). Sometimes, however, we only care about extracting a single header. Code in this situation is stuck doing an ad-hoc parse of the commit buffer. Let's