Page MenuHomeFreeBSD

D36646.diff
No OneTemporary

D36646.diff

diff --git a/sys/sys/tree.h b/sys/sys/tree.h
--- a/sys/sys/tree.h
+++ b/sys/sys/tree.h
@@ -598,6 +598,10 @@
RB_ROTATE(parent, child, sibdir, field); \
_RB_UP(child, field) = gpar; \
RB_SWAP_CHILD(head, gpar, parent, child, field); \
+ /* \
+ * Elements rotated down have new, smaller subtrees, \
+ * so update augmentation for them. \
+ */ \
if (elm != child) \
RB_AUGMENT_CHECK(elm); \
RB_AUGMENT_CHECK(parent); \
@@ -724,6 +728,11 @@
RB_ROTATE(parent, elm, elmdir, field); \
RB_SET_PARENT(elm, gpar, field); \
RB_SWAP_CHILD(head, gpar, parent, elm, field); \
+ /* \
+ * An element rotated down, but not into the search \
+ * path has a new, smaller subtree, so update \
+ * augmentation for it. \
+ */ \
if (sib != elm) \
RB_AUGMENT_CHECK(sib); \
return (parent); \
@@ -779,6 +788,11 @@
} \
_RB_AUGMENT_WALK(parent, opar, field); \
if (opar != NULL) { \
+ /* \
+ * Elements rotated into the search path have \
+ * changed subtrees, so update augmentation for \
+ * them if AUGMENT_WALK didn't. \
+ */ \
RB_AUGMENT_CHECK(opar); \
RB_AUGMENT_CHECK(RB_PARENT(opar, field)); \
} \
@@ -811,6 +825,11 @@
tmp = name##_RB_INSERT_COLOR(head, parent, elm); \
_RB_AUGMENT_WALK(elm, tmp, field); \
if (tmp != NULL) \
+ /* \
+ * An element rotated into the search path has a \
+ * changed subtree, so update augmentation for it if \
+ * AUGMENT_WALK didn't. \
+ */ \
RB_AUGMENT_CHECK(tmp); \
return (NULL); \
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 13, 7:07 PM (19 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15785951
Default Alt Text
D36646.diff (1 KB)

Event Timeline