golf down ancestor caching
This commit is contained in:
parent
ee8299864f
commit
702b8e3107
13
shape.c
13
shape.c
@ -384,15 +384,7 @@ rb_shape_alloc(ID edge_name, rb_shape_t * parent, enum shape_type type)
|
|||||||
static redblack_node_t *
|
static redblack_node_t *
|
||||||
redblack_cache_ancestors(rb_shape_t * shape)
|
redblack_cache_ancestors(rb_shape_t * shape)
|
||||||
{
|
{
|
||||||
if (shape->ancestor_index) {
|
if (!(shape->ancestor_index || shape->parent_id == INVALID_SHAPE_ID)) {
|
||||||
return shape->ancestor_index;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (shape->parent_id == INVALID_SHAPE_ID) {
|
|
||||||
// We're at the root
|
|
||||||
return shape->ancestor_index;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
redblack_node_t * parent_index;
|
redblack_node_t * parent_index;
|
||||||
|
|
||||||
parent_index = redblack_cache_ancestors(rb_shape_get_parent(shape));
|
parent_index = redblack_cache_ancestors(rb_shape_get_parent(shape));
|
||||||
@ -403,10 +395,9 @@ redblack_cache_ancestors(rb_shape_t * shape)
|
|||||||
else {
|
else {
|
||||||
shape->ancestor_index = parent_index;
|
shape->ancestor_index = parent_index;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return shape->ancestor_index;
|
return shape->ancestor_index;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static redblack_node_t *
|
static redblack_node_t *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user