From 108f530385e969feab343b2b8acadeb7bb670009 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 16 Aug 2018 08:13:12 +0200 Subject: pack-objects: move tree_depth into 'struct packing_data' This reduces the size of 'struct object_entry' and therefore makes packing objects more efficient. This also renames cmp_tree_depth() into tree_depth_compare(), as it is more modern to have the name of the compare functions end with "compare". Helped-by: Jeff King Helped-by: Duy Nguyen Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- pack-objects.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pack-objects.c') diff --git a/pack-objects.c b/pack-objects.c index 92708522e7..30314572e6 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -160,6 +160,9 @@ struct object_entry *packlist_alloc(struct packing_data *pdata, if (!pdata->in_pack_by_idx) REALLOC_ARRAY(pdata->in_pack, pdata->nr_alloc); + + if (pdata->tree_depth) + REALLOC_ARRAY(pdata->tree_depth, pdata->nr_alloc); } new_entry = pdata->objects + pdata->nr_objects++; @@ -175,5 +178,8 @@ struct object_entry *packlist_alloc(struct packing_data *pdata, if (pdata->in_pack) pdata->in_pack[pdata->nr_objects - 1] = NULL; + if (pdata->tree_depth) + pdata->tree_depth[pdata->nr_objects - 1] = 0; + return new_entry; } -- cgit v1.3