Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-12 Thread René Scharfe
Am 10.07.2017 um 04:10 schrieb Junio C Hamano: Jeff King writes: ... And you could even drop origlen by replacing it with "baselen - 3" at the end. But somehow doing the computation on the fly actually seems more complicated to me (from the perspective of a reader who is trying

Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-09 Thread Junio C Hamano
Jeff King writes: > ... And you could even drop origlen by > replacing it with "baselen - 3" at the end. But somehow doing the > computation on the fly actually seems more complicated to me (from the > perspective of a reader who is trying to make sure all is correct). True

Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-09 Thread Jeff King
On Sun, Jul 09, 2017 at 09:41:51AM -0700, Junio C Hamano wrote: > > On the plus side, this moves an invariant out of the loop. On the minus > > side, it has to introduce an extra variable for "length we add on to" > > versus "dir length to pass to the subdir_cb". That's not rocket science, > >

Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-09 Thread Junio C Hamano
Jeff King writes: > On Sat, Jul 08, 2017 at 10:59:06AM +0200, René Scharfe wrote: > >> Add the slash between loose object subdirectory and file name just once >> outside the loop instead of overwriting it with each readdir call. >> Redefine baselen as the length with that slash,

Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-09 Thread René Scharfe
Am 09.07.2017 um 13:00 schrieb Jeff King: On Sat, Jul 08, 2017 at 10:59:06AM +0200, René Scharfe wrote: Add the slash between loose object subdirectory and file name just once outside the loop instead of overwriting it with each readdir call. Redefine baselen as the length with that slash, and

Re: [PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-09 Thread Jeff King
On Sat, Jul 08, 2017 at 10:59:06AM +0200, René Scharfe wrote: > Add the slash between loose object subdirectory and file name just once > outside the loop instead of overwriting it with each readdir call. > Redefine baselen as the length with that slash, and add dirlen for the > length without

[PATCH] sha1_file: add slash once in for_each_file_in_obj_subdir()

2017-07-08 Thread René Scharfe
Add the slash between loose object subdirectory and file name just once outside the loop instead of overwriting it with each readdir call. Redefine baselen as the length with that slash, and add dirlen for the length without it. The result is slightly less wasteful and can use the the cheaper