[PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-17 Thread Stefan Beller
This was missed in 5982da9d2ce (replace-object: allow prepare_replace_object to handle arbitrary repositories, 2018-04-11) Technically the code works correctly as the replace_map is the same size in different repositories, however it is hard to read. So convert the code to the familiar pattern of

Re: [PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-10 Thread Stefan Beller
> Using `git grep` I see 230 instances of 'xmalloc' and 261 instances of > 'xcalloc'. After the Coccinelle transformation, these are down to 194 and > 190, respectively, because the rest allocate in the same line as the > definition. It's worth thinking about the macro pattern for those cases.

Re: [PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-10 Thread Derrick Stolee
On 5/10/2018 7:56 AM, Jeff King wrote: On Thu, May 10, 2018 at 07:23:13PM +0900, Junio C Hamano wrote: This one was doing ptr = xmalloc(sizeof(*another_ptr)) and it was OK because ptr and another_ptr happened to be of the same type. I wonder if we are making it safer, or making it

Re: [PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-10 Thread Jeff King
On Thu, May 10, 2018 at 07:23:13PM +0900, Junio C Hamano wrote: > This one was doing > > ptr = xmalloc(sizeof(*another_ptr)) > > and it was OK because ptr and another_ptr happened to be of the same > type. I wonder if we are making it safer, or making it more obscure > to seasoned C

Re: [PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-10 Thread Junio C Hamano
Stefan Beller writes: > This was missed in 5982da9d2ce (replace-object: allow > prepare_replace_object to handle arbitrary repositories, 2018-04-11) > > Technically the code works correctly as the replace_map is the same > size in different repositories, however it is hard to

[PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

2018-05-09 Thread Stefan Beller
This was missed in 5982da9d2ce (replace-object: allow prepare_replace_object to handle arbitrary repositories, 2018-04-11) Technically the code works correctly as the replace_map is the same size in different repositories, however it is hard to read. So convert the code to the familiar pattern of