Re: [PATCH 1/2] commit: be more precise when searching for headers
On Sat, Feb 25, 2017 at 08:21:52PM +0100, René Scharfe wrote:
Show 10 quoted lines
> Search for a space character only within the current line in
> read_commit_extra_header_lines() instead of searching in the whole
> buffer (and possibly beyond, if it's not NUL-terminated) and then
> discarding any results after the end of the current line.
> [...]
> - eof = strchr(line, ' ');
> - if (next <= eof)
> + eof = memchr(line, ' ', next - line);
> + if (!eof)
> eof = next;
Nice. More efficient, and I think the intent is more clear.
-Peff