Unverified Commit b474c9cc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Nils Goroll

Neuter the VRBT_AUGMENT facility if not used.

parent 1fbe32e2
...@@ -370,7 +370,16 @@ struct { \ ...@@ -370,7 +370,16 @@ struct { \
* from the bottom up to the root, to update augmented node data. * from the bottom up to the root, to update augmented node data.
*/ */
#ifndef VRBT_AUGMENT #ifndef VRBT_AUGMENT
#define VRBT_AUGMENT(x) break #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 #endif
#define VRBT_SWAP_CHILD(head, out, in, field) do { \ #define VRBT_SWAP_CHILD(head, out, in, field) do { \
...@@ -631,10 +640,7 @@ name##_VRBT_REMOVE(struct name *head, struct type *elm) \ ...@@ -631,10 +640,7 @@ name##_VRBT_REMOVE(struct name *head, struct type *elm) \
VRBT_SET_PARENT(child, parent, field); \ VRBT_SET_PARENT(child, parent, field); \
if (parent != NULL) \ if (parent != NULL) \
name##_VRBT_REMOVE_COLOR(head, parent, child); \ name##_VRBT_REMOVE_COLOR(head, parent, child); \
while (parent != NULL) { \ VRBT_AUGMENT_UP(parent); \
VRBT_AUGMENT(parent); \
parent = VRBT_PARENT(parent, field); \
} \
return (old); \ return (old); \
} }
...@@ -665,10 +671,7 @@ name##_VRBT_INSERT(struct name *head, struct type *elm) \ ...@@ -665,10 +671,7 @@ name##_VRBT_INSERT(struct name *head, struct type *elm) \
else \ else \
VRBT_RIGHT(parent, field) = elm; \ VRBT_RIGHT(parent, field) = elm; \
name##_VRBT_INSERT_COLOR(head, elm); \ name##_VRBT_INSERT_COLOR(head, elm); \
while (elm != NULL) { \ VRBT_AUGMENT_UP(elm); \
VRBT_AUGMENT(elm); \
elm = VRBT_PARENT(elm, field); \
} \
return (NULL); \ 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