aboutsummaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/commit.c b/commit.c
index 0c4ee3de42..73c78c2b80 100644
--- a/commit.c
+++ b/commit.c
@@ -1307,11 +1307,11 @@ void for_each_mergetag(each_mergetag_fn fn, struct commit *commit, void *data)
static inline int standard_header_field(const char *field, size_t len)
{
- return ((len == 4 && !memcmp(field, "tree ", 5)) ||
- (len == 6 && !memcmp(field, "parent ", 7)) ||
- (len == 6 && !memcmp(field, "author ", 7)) ||
- (len == 9 && !memcmp(field, "committer ", 10)) ||
- (len == 8 && !memcmp(field, "encoding ", 9)));
+ return ((len == 4 && !memcmp(field, "tree", 4)) ||
+ (len == 6 && !memcmp(field, "parent", 6)) ||
+ (len == 6 && !memcmp(field, "author", 6)) ||
+ (len == 9 && !memcmp(field, "committer", 9)) ||
+ (len == 8 && !memcmp(field, "encoding", 8)));
}
static int excluded_header_field(const char *field, size_t len, const char **exclude)
@@ -1321,8 +1321,7 @@ static int excluded_header_field(const char *field, size_t len, const char **exc
while (*exclude) {
size_t xlen = strlen(*exclude);
- if (len == xlen &&
- !memcmp(field, *exclude, xlen) && field[xlen] == ' ')
+ if (len == xlen && !memcmp(field, *exclude, xlen))
return 1;
exclude++;
}
@@ -1353,12 +1352,11 @@ static struct commit_extra_header *read_commit_extra_header_lines(
strbuf_reset(&buf);
it = NULL;
- eof = strchr(line, ' ');
- if (next <= eof)
+ eof = memchr(line, ' ', next - line);
+ if (!eof)
eof = next;
-
- if (standard_header_field(line, eof - line) ||
- excluded_header_field(line, eof - line, exclude))
+ else if (standard_header_field(line, eof - line) ||
+ excluded_header_field(line, eof - line, exclude))
continue;
it = xcalloc(1, sizeof(*it));
c9c4d0fe023b508f1b41dbe2a3f3133f81b4d29&follow=1'>bonding: reduce scope of some global variablesMahesh Bandewar1-6/+5 2017-03-09bonding: remove "port-moved" state that was never implementedMahesh Bandewar1-8/+3 2017-03-09bonding: remove hardcoded valueMahesh Bandewar1-1/+13 2017-03-09bonding: initialize work-queues during creation of bondMahesh Bandewar1-2/+2 2017-03-09bonding: restructure arp-monitorMahesh Bandewar1-10/+14 2017-03-09nfp: prevent theoretical buffer overrun in nfp_eth_read_portsSimon Horman1-14/+20 2017-03-09nfp: add metadata format bitJakub Kicinski2-1/+5 2017-03-09nfp: avoid rearming the interrupts when in busy pollJakub Kicinski1-4/+3 2017-03-09nfp: store device pointer for the fastpathJakub Kicinski4-38/+31 2017-03-09nfp: reorder variables in nfp_net_tx()Jakub Kicinski1-2/+2 2017-03-09nfp: move more ring debug info to debugfsJakub Kicinski2-13/+9 2017-03-09nfp: implement .ndo_get_phys_port_name()Jakub Kicinski5-5/+69 2017-03-09nfp: add support for reporting CRC32 hash functionJakub Kicinski4-11/+75 2017-03-09ethtool: add CRC32 as an RSS hash functionJakub Kicinski2-0/+3 2017-03-09net/socket: use per af lockdep classes for sk queuesPaolo Abeni1-18/+78 2017-03-09net: dwc-xlgmac: Initial driver for DesignWare Enterprise EthernetJie Deng12-0/+7399 2017-03-09MAINTAINERS: Add entry for APM X-Gene SoC Ethernet (v2) driverIyappan Subramanian3-5/+11 2017-03-09drivers: net: xgene-v2: Add transmit and receiveIyappan Subramanian6-1/+267