Re: [PATCHv2] mailmap: handle mailmap blobs without trailing newlines

2013-08-28 Thread Junio C Hamano
Jeff King p...@peff.net writes: This makes the code simpler and shorter (because we don't have to correlate strchrnul with the length calculation), correct (because the code with the off-by-one just goes away), and more efficient (we can drop the extra allocation we needed to create

[PATCHv2] mailmap: handle mailmap blobs without trailing newlines

2013-08-27 Thread Jeff King
The read_mailmap_buf function reads each line of the mailmap using strchrnul, like: const char *end = strchrnul(buf, '\n'); unsigned long linelen = end - buf + 1; But that's off-by-one when we actually hit the NUL byte; our line does not have a terminator, and so is only end - buf bytes