For stochastic bisection we will need to store more information per commit. Make commit_weight slab store void * instead of int * so that we can reuse it for stochastic bisection as well. Signed-off-by: Jan Kara <jack@xxxxxxx> --- bisect.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bisect.c b/bisect.c index f87753d0c67c..7416a57db4e3 100644 --- a/bisect.c +++ b/bisect.c @@ -77,19 +77,25 @@ static void clear_distance(struct commit_list *list) } } -define_commit_slab(commit_weight, int *); +define_commit_slab(commit_weight, void *); static struct commit_weight commit_weight; #define DEBUG_BISECT 0 +static inline int has_weight(struct commit_list *elem) +{ + return commit_weight.slab_size > 0 && + *commit_weight_at(&commit_weight, elem->item) != NULL; +} + static inline int weight(struct commit_list *elem) { - return **commit_weight_at(&commit_weight, elem->item); + return *(int *)*commit_weight_at(&commit_weight, elem->item); } static inline void weight_set(struct commit_list *elem, int weight) { - **commit_weight_at(&commit_weight, elem->item) = weight; + *(int *)*commit_weight_at(&commit_weight, elem->item) = weight; } static int count_interesting_parents(struct commit *commit, unsigned bisect_flags) @@ -163,7 +169,7 @@ static void show_list(const char *debug, int counted, int nr, (commit_flags & TREESAME) ? ' ' : 'T', (commit_flags & UNINTERESTING) ? 'U' : ' ', (commit_flags & COUNTED) ? 'C' : ' '); - if (*commit_weight_at(&commit_weight, p->item)) + if (has_weight(p)) fprintf(stderr, "%3d", weight(p)); else fprintf(stderr, "---"); -- 2.26.2