It's done so that commit->util can be removed. See more explanation in
the commit that removes commit->util.
Signed-off-by: Nguyễn Thái Ngọc Duy
---
bisect.c | 12 +---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/bisect.c b/bisect.c
index a579b50884..6de1abd407 100644
--- a/bisect.c
+++ b/bisect.c
@@ -12,6 +12,7 @@
#include "bisect.h"
#include "sha1-array.h"
#include "argv-array.h"
+#include "commit-slab.h"
static struct oid_array good_revs;
static struct oid_array skipped_revs;
@@ -70,16 +71,19 @@ static void clear_distance(struct commit_list *list)
}
}
+define_commit_slab(commit_weight, int *);
+static struct commit_weight commit_weight;
+
#define DEBUG_BISECT 0
static inline int weight(struct commit_list *elem)
{
- return *((int*)(elem->item->util));
+ return **commit_weight_at(_weight, elem->item);
}
static inline void weight_set(struct commit_list *elem, int weight)
{
- *((int*)(elem->item->util)) = weight;
+ **commit_weight_at(_weight, elem->item) = weight;
}
static int count_interesting_parents(struct commit *commit)
@@ -265,7 +269,7 @@ static struct commit_list *do_find_bisection(struct
commit_list *list,
struct commit *commit = p->item;
unsigned flags = commit->object.flags;
- p->item->util = [n++];
+ *commit_weight_at(_weight, p->item) = [n++];
switch (count_interesting_parents(commit)) {
case 0:
if (!(flags & TREESAME)) {
@@ -372,6 +376,7 @@ void find_bisection(struct commit_list **commit_list, int
*reaches,
int *weights;
show_list("bisection 2 entry", 0, 0, *commit_list);
+ init_commit_weight(_weight);
/*
* Count the number of total and tree-changing items on the
@@ -412,6 +417,7 @@ void find_bisection(struct commit_list **commit_list, int
*reaches,
}
free(weights);
*commit_list = best;
+ clear_commit_weight(_weight);
}
static int register_ref(const char *refname, const struct object_id *oid,
--
2.17.0.705.g3525833791