|
12 | 12 | #include "bisect.h"
|
13 | 13 | #include "sha1-array.h"
|
14 | 14 | #include "argv-array.h"
|
| 15 | +#include "commit-slab.h" |
15 | 16 |
|
16 | 17 | static struct oid_array good_revs;
|
17 | 18 | static struct oid_array skipped_revs;
|
@@ -70,16 +71,19 @@ static void clear_distance(struct commit_list *list)
|
70 | 71 | }
|
71 | 72 | }
|
72 | 73 |
|
| 74 | +define_commit_slab(commit_weight, int *); |
| 75 | +static struct commit_weight commit_weight; |
| 76 | + |
73 | 77 | #define DEBUG_BISECT 0
|
74 | 78 |
|
75 | 79 | static inline int weight(struct commit_list *elem)
|
76 | 80 | {
|
77 |
| - return *((int*)(elem->item->util)); |
| 81 | + return **commit_weight_at(&commit_weight, elem->item); |
78 | 82 | }
|
79 | 83 |
|
80 | 84 | static inline void weight_set(struct commit_list *elem, int weight)
|
81 | 85 | {
|
82 |
| - *((int*)(elem->item->util)) = weight; |
| 86 | + **commit_weight_at(&commit_weight, elem->item) = weight; |
83 | 87 | }
|
84 | 88 |
|
85 | 89 | static int count_interesting_parents(struct commit *commit)
|
@@ -265,7 +269,7 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
|
265 | 269 | struct commit *commit = p->item;
|
266 | 270 | unsigned flags = commit->object.flags;
|
267 | 271 |
|
268 |
| - p->item->util = &weights[n++]; |
| 272 | + *commit_weight_at(&commit_weight, p->item) = &weights[n++]; |
269 | 273 | switch (count_interesting_parents(commit)) {
|
270 | 274 | case 0:
|
271 | 275 | if (!(flags & TREESAME)) {
|
@@ -372,6 +376,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
|
372 | 376 | int *weights;
|
373 | 377 |
|
374 | 378 | show_list("bisection 2 entry", 0, 0, *commit_list);
|
| 379 | + init_commit_weight(&commit_weight); |
375 | 380 |
|
376 | 381 | /*
|
377 | 382 | * 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,
|
412 | 417 | }
|
413 | 418 | free(weights);
|
414 | 419 | *commit_list = best;
|
| 420 | + clear_commit_weight(&commit_weight); |
415 | 421 | }
|
416 | 422 |
|
417 | 423 | static int register_ref(const char *refname, const struct object_id *oid,
|
|
0 commit comments