summaryrefslogtreecommitdiff
path: root/reachable.h
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-14 19:19:54 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-01-16 14:28:27 -0800
commit2baad220138b10582c55ef942466f2b8df18944f (patch)
tree5f180470742903211bdce7e6139762deebf9dde2 /reachable.h
parentEliminate recursion in setting/clearing marks in commit list (diff)
downloadtgif-2baad220138b10582c55ef942466f2b8df18944f.tar.xz
index-pack: eliminate recursion in find_unresolved_deltas
Current find_unresolved_deltas() links all bases together in a form of tree, using struct base_data, with prev_base pointer to point to parent node. Then it traverses down from parent to children in recursive manner with all base_data allocated on stack. To eliminate recursion, we simply need to put all on heap (parse_pack_objects and fix_unresolved_deltas). After that, it's simple non-recursive depth-first traversal loop. Each node also maintains its own state (ofs and ref indices) to iterate over all children nodes. So we process one node: - if it returns a new (child) node (a parent base), we link it to our tree, then process the new node. - if it returns nothing, the node is done, free it. We go back to parent node and resume whatever it's doing. and do it until we have no nodes to process. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reachable.h')
0 files changed, 0 insertions, 0 deletions