Re: [PATCH] Attempt to clarify "Augmented Trees" section ofDocumentation/rbtree.txt

From: Peter Zijlstra
Date: Fri Apr 15 2011 - 06:52:33 EST


On Thu, 2011-04-14 at 14:22 -0500, Rob Landley wrote:
> +This function is called when either of a node's children change. It is not
> +called recursively: the callback function is responsible for traversing parent
> +nodes and updating their information as necessary.

static void rb_augment_path(struct rb_node *node, rb_augment_f func, void *data)
{
struct rb_node *parent;

up:
func(node, data);
parent = rb_parent(node);
if (!parent)
return;

if (node == parent->rb_left && parent->rb_right)
func(parent->rb_right, data);
else if (parent->rb_left)
func(parent->rb_left, data);

node = parent;
goto up;
}

Uhm, what?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/