From: Jeff King Date: Mon, 23 Jun 2014 16:47:42 GMT Subject: Re: [PATCH 1/7] commit: provide a function to find a header in a buffer Message-ID: <20140623164742.GA4838@sigill.intra.peff.net> In-Reply-To: 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