Jeff King 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 NUL-terminated st
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
2 matches
Mail list logo