From: Jeff King Date: Sat, 25 Feb 2017 20:12:38 GMT Subject: Re: [PATCH 1/2] commit: be more precise when searching for headers Message-ID: <20170225201238.wkujdwg4jyvovelm@sigill.intra.peff.net> In-Reply-To: <23989e76-24ba-90a4-91a9-9f66bfccb7c9@web.de> On Sat, Feb 25, 2017 at 08:21:52PM +0100, René Scharfe wrote: > 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