vtree.h: remove red/black tree augmentation entirely

As agreed with phk
parent b474c9cc
......@@ -365,23 +365,6 @@ struct { \
VRBT_RED_LEFT(VRBT_PARENT(elm, field), field) : \
VRBT_RED_RIGHT(VRBT_PARENT(elm, field), field))
/*
* Something to be invoked in a loop at the root of every modified subtree,
* from the bottom up to the root, to update augmented node data.
*/
#ifndef VRBT_AUGMENT
#define VRBT_AUGMENT(x) do {} while (0)
#define VRBT_AUGMENT_UP(x) do {} while (0)
#else
#define VRBT_AUGMENT_UP(x) \
do { \
while((x) != NULL) { \
VRBT_AUGMENT(x); \
x = VRBT_PARENT(x, field); \
} \
} while (0)
#endif
#define VRBT_SWAP_CHILD(head, out, in, field) do { \
if (VRBT_PARENT(out, field) == NULL) \
VRBT_ROOT(head) = (in); \
......@@ -400,7 +383,6 @@ struct { \
VRBT_SWAP_CHILD(head, elm, tmp, field); \
VRBT_LEFT(tmp, field) = (elm); \
VRBT_SET_PARENT(elm, tmp, field); \
VRBT_AUGMENT(elm); \
} while (/*CONSTCOND*/ 0)
#define VRBT_ROTATE_RIGHT(head, elm, tmp, field) do { \
......@@ -412,7 +394,6 @@ struct { \
VRBT_SWAP_CHILD(head, elm, tmp, field); \
VRBT_RIGHT(tmp, field) = (elm); \
VRBT_SET_PARENT(elm, tmp, field); \
VRBT_AUGMENT(elm); \
} while (/*CONSTCOND*/ 0)
/* Generates prototypes and inline functions */
......@@ -640,7 +621,6 @@ name##_VRBT_REMOVE(struct name *head, struct type *elm) \
VRBT_SET_PARENT(child, parent, field); \
if (parent != NULL) \
name##_VRBT_REMOVE_COLOR(head, parent, child); \
VRBT_AUGMENT_UP(parent); \
return (old); \
}
......@@ -671,7 +651,6 @@ name##_VRBT_INSERT(struct name *head, struct type *elm) \
else \
VRBT_RIGHT(parent, field) = elm; \
name##_VRBT_INSERT_COLOR(head, elm); \
VRBT_AUGMENT_UP(elm); \
return (NULL); \
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment