Subject: Re: [PATCH 1/8] fixup! combine_diff: simplify intersect_paths() further

From: Junio C Hamano <[email-masked]>
Date: Mon, 03 Feb 2014 11:40:18 -0800

Kirill Smelkov <[email-masked]> writes:

> That cleanup patch is good, but I've found a bug in it. In the item removal
> code
>
>> +                      /* p->path not in q->queue[]; drop it */
>> +                      struct combine_diff_path *next = p->next;
>> +
>> +                      if ((*tail = next) != NULL)
>> +                              tail = &next->next;
>> +                      free(p);
>>                        continue;
>
>         *tail = next
>
> is right, but
>
>         tail = &next->next
>
> is wrong,

Heh, surely.  We just have skipped, and the fact that tail points at
the pointer variable that points at the first of the remaining items
does not change with this skipping of next by assigning it to *tail.  
An extra assignment to tail will skip one more, which is unnecessary.