Re: [PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-27 Thread René Scharfe
Am 27.02.2017 um 23:27 schrieb Jakub Narębski: W dniu 25.02.2017 o 20:27, René Scharfe pisze: Both standard_header_field() and excluded_header_field() check if there's a space after the buffer that's handed to them. We already check in the caller if that space is present. Don't bother calling

Re: [PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-27 Thread Jakub Narębski
W dniu 25.02.2017 o 20:27, René Scharfe pisze: > Both standard_header_field() and excluded_header_field() check if > there's a space after the buffer that's handed to them. We already > check in the caller if that space is present. Don't bother calling > the functions if it's missing, as they

Re: [PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-25 Thread Jeff King
On Sat, Feb 25, 2017 at 10:39:29PM +0100, René Scharfe wrote: > > > + (len == 8 && !memcmp(field, "encoding", 8))); > > > > Unrelated, but this could probably be spelled with a macro and strlen() > > to avoid the magic numbers. It would probably be measurably slower for a > > compiler

Re: [PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-25 Thread René Scharfe
Am 25.02.2017 um 21:15 schrieb Jeff King: On Sat, Feb 25, 2017 at 08:27:40PM +0100, René Scharfe wrote: Both standard_header_field() and excluded_header_field() check if there's a space after the buffer that's handed to them. We already check in the caller if that space is present. Don't

Re: [PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-25 Thread Jeff King
On Sat, Feb 25, 2017 at 08:27:40PM +0100, René Scharfe wrote: > Both standard_header_field() and excluded_header_field() check if > there's a space after the buffer that's handed to them. We already > check in the caller if that space is present. Don't bother calling > the functions if it's

[PATCH 2/2] commit: don't check for space twice when looking for header

2017-02-25 Thread René Scharfe
Both standard_header_field() and excluded_header_field() check if there's a space after the buffer that's handed to them. We already check in the caller if that space is present. Don't bother calling the functions if it's missing, as they are guaranteed to return 0 in that case, and remove the