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

2013-08-25 Thread Jeff King
On Sun, Aug 25, 2013 at 04:55:00AM -0400, Jeff King wrote: > On Sun, Aug 25, 2013 at 04:45:50AM -0400, Jeff King wrote: > > > This is the minimal fix. Another option would be to switch > > read_mailmap_buf to read_mailmap_string, and I think we could even get > > away with avoiding the extra allo

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

2013-08-25 Thread Jeff King
On Sun, Aug 25, 2013 at 04:45:50AM -0400, Jeff King wrote: > This is the minimal fix. Another option would be to switch > read_mailmap_buf to read_mailmap_string, and I think we could even get > away with avoiding the extra allocation/copy in the loop (because > read_mailmap_line seems to cope wit

[PATCH] mailmap: handle mailmap blobs without trailing newlines

2013-08-25 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