Re: [PATCH v2 11/21] bisect: use struct node_data array instead of int array
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Apr 12, 2016, 23:02 UTC
- Message-ID
- <CAP8UFD2foPEUXDD4_Y8K6hN1bWLJk11iqYXS=tM+M3eF430o7A@mail.gmail.com>
- In-Reply-To
- <1460294354-7031-12-git-send-email-s-beyer@gmx.net>
On Sun, Apr 10, 2016 at 3:19 PM, Stephan Beyer <s-beyer@gmx.net> wrote:
Show 9 quoted lines
>
> @@ -321,14 +321,13 @@ static struct commit_list *do_find_bisection(struct commit_list *list,
> * add one for p itself if p is to be counted,
> * otherwise inherit it from q directly.
> */
> + node_data(p->item)->weight = node_data(q->item)->weight;
> if (!(flags & TREESAME)) {
> - weight_set(p, weight(q)+1);
> + node_data(p->item)->weight++;It is not so easy to see that the above does the same thing as before.
Maybe review would be easier if this part of the code was simplified in a separate patch and/or if the weight() and weight_set() function were kept, maybe like this:
static inline int weight(struct commit *elem)
{
return node_data(elem)->weight;
}static inline void set_weight(struct commit *elem, int weight)
{
node_data(elem)->weight = weight;
}Show 9 quoted lines
> counted++;
> show_list("bisection 2 count one",
> counted, nr, list);
> }
> - else
> - weight_set(p, weight(q));
>
> /* Does it happen to be at exactly half-way? */
> if (!find_all && halfway(p, nr))