From bb408ac95d34b26cb39f7796d66092fcc004c60c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 19 May 2018 07:28:25 +0200 Subject: [PATCH] bisect.c: use commit-slab for commit weight instead of commit->util It's done so that commit->util can be removed. See more explanation in the commit that removes commit->util. Signed-off-by: Junio C Hamano --- 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(&commit_weight, elem->item); } static inline void weight_set(struct commit_list *elem, int weight) { - *((int*)(elem->item->util)) = weight; + **commit_weight_at(&commit_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 = &weights[n++]; + *commit_weight_at(&commit_weight, p->item) = &weights[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(&commit_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(&commit_weight); } static int register_ref(const char *refname, const struct object_id *oid, -- 2.11.4.GIT