Re: [PATCH 1/7] commit: provide a function to find a header in a buffer
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