From: Junio C Hamano Date: Mon, 03 Feb 2014 19:40:18 GMT Subject: Re: [PATCH 1/8] fixup! combine_diff: simplify intersect_paths() further Message-ID: In-Reply-To: <60ec61bdd2ef3cba7537e29c42f9c8a810da245d.1391430523.git.kirr@mns.spb.ru> Kirill Smelkov 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.