Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- replace-object.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/replace-object.c b/replace-object.c index 9272c7acbf..b3bfd21541 100644 --- a/replace-object.c +++ b/replace-object.c @@ -19,32 +19,31 @@ static int replace_object_pos(struct repository *r, const unsigned char *sha1) replace_sha1_access); } -#define register_replace_object(r, rp, i) \ - register_replace_object_##r(rp, i) -static int register_replace_object_the_repository(struct replace_object *replace, - int ignore_dups) +static int register_replace_object(struct repository *r, + struct replace_object *replace, + int ignore_dups) { - int pos = replace_object_pos(the_repository, replace->original); + int pos = replace_object_pos(r, replace->original); if (0 <= pos) { if (ignore_dups) free(replace); else { - free( the_repository->objects->replacements.items[pos]); - the_repository->objects->replacements.items[pos] = replace; + free(r->objects->replacements.items[pos]); + r->objects->replacements.items[pos] = replace; } return 1; } pos = -pos - 1; - ALLOC_GROW( the_repository->objects->replacements.items, - the_repository->objects->replacements.nr + 1, - the_repository->objects->replacements.alloc); - the_repository->objects->replacements.nr++; - if (pos < the_repository->objects->replacements.nr) - MOVE_ARRAY( the_repository->objects->replacements.items + pos + 1, - the_repository->objects->replacements.items + pos, - the_repository->objects->replacements.nr - pos - 1); - the_repository->objects->replacements.items[pos] = replace; + ALLOC_GROW(r->objects->replacements.items, + r->objects->replacements.nr + 1, + r->objects->replacements.alloc); + r->objects->replacements.nr++; + if (pos < r->objects->replacements.nr) + MOVE_ARRAY(r->objects->replacements.items + pos + 1, + r->objects->replacements.items + pos, + r->objects->replacements.nr - pos - 1); + r->objects->replacements.items[pos] = replace; return 0; } -- 2.17.0.484.g0c8726318c-goog