Re: [PATCH 02/14] log: refactor add_header to drop some magic numbers

2016-01-01 Thread Jeff King
On Thu, Dec 31, 2015 at 01:21:42AM -0500, Eric Sunshine wrote: > > - item->string[len] = '\0'; > > + len = strlen(item->string); > > + while (len && item->string[len - 1] == '\n') > > + item->string[--len] = '\0'; > > Not a strong objection, but this

Re: [PATCH 02/14] log: refactor add_header to drop some magic numbers

2016-01-01 Thread Jeff King
On Fri, Jan 01, 2016 at 03:42:06AM -0500, Jeff King wrote: > On Thu, Dec 31, 2015 at 01:21:42AM -0500, Eric Sunshine wrote: > > > > - item->string[len] = '\0'; > > > + len = strlen(item->string); > > > + while (len && item->string[len - 1] == '\n') > > > +

Re: [PATCH 02/14] log: refactor add_header to drop some magic numbers

2015-12-30 Thread Eric Sunshine
On Tue, Dec 29, 2015 at 2:20 AM, Jeff King wrote: > We want to chomp newlines off the end of the "value" string. > But because it's const, we must track its length rather than > writing a NUL. This leads to us having to tweak that length > later, to account for moving the pointer

[PATCH 02/14] log: refactor add_header to drop some magic numbers

2015-12-28 Thread Jeff King
We want to chomp newlines off the end of the "value" string. But because it's const, we must track its length rather than writing a NUL. This leads to us having to tweak that length later, to account for moving the pointer forward. Since we are about to create a copy of it anyway, let's just wait