mark_parents_uninteresting(): replace list with stack
commit43fc643b75af91363eb1246528c706c1654ddc2e
authorJeff King <peff@peff.net>
Fri, 11 May 2018 18:02:27 +0000 (11 14:02 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 May 2018 02:23:59 +0000 (13 11:23 +0900)
tree405c4d4b7c6e16ec2cabbd276541bf4b2e7a33d1
parent577dd0d29bf7cbbdf1f00c20a90caac50b1c603f
mark_parents_uninteresting(): replace list with stack

The mark_parents_uninteresting() function uses two loops:
an outer one to process our queue of pending parents, and an
inner one to process first-parent chains. This is a clever
optimization from 941ba8db57 (Eliminate recursion in
setting/clearing marks in commit list, 2012-01-14) to limit
the number of linked-list allocations when following
single-parent chains.

Unfortunately, this makes the result a little hard to read.
Let's replace the list with a stack. Then we don't have to
worry about doing this double-loop optimization, as we'll
just reuse the top element of the stack as we pop/push.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c