libabigail
Canonical diff tree nodes

How equivalent diff nodes are quickly spotted.

How equivalent diff nodes are quickly spotted.

Equivalence of diff nodes.

Each diff node has a property named Canonical Diff Node. If D is a diff node, the canonical diff node of D, noted C(D) is a particular diff node that is equal to D. Thus, a fast way to compare two diff node is to perform a pointer comparison of their canonical diff nodes.

A set of equivalent diff nodes is a set of diff nodes that all have the same canonical node. All the nodes of that set are equal.

A canonical node is registereded for a given diff node by invoking the method diff_context::initialize_canonical_diff().

Please note that the diff_context holds all the canonical diffs that got registered through it. Thus, the life time of all of canonical diff objects is the same as the life time of the diff_context they relate to.