VOID
FixupChildLinks(PRTL_SPLAY_LINKS Links, BOOLEAN Root, BOOLEAN LeftChild)
{
- if (RtlLeftChild(Links)) {
+ if (RtlLeftChild(Links))
RtlInsertAsLeftChild(Links, RtlLeftChild(Links));
- }
- if (RtlRightChild(Links)) {
+
+ if (RtlRightChild(Links))
RtlInsertAsRightChild(Links, RtlRightChild(Links));
- }
- if (!Root) {
- if (LeftChild) {
+
+ if (!Root)
+ {
+ if (LeftChild)
RtlInsertAsLeftChild(RtlParent(Links), Links);
- } else {
+ else
RtlInsertAsRightChild(RtlParent(Links), Links);
- }
}
}
Set Q's parent to S, and the proper child ptr of S to Q
When Q is the root,
Set S's parent to S
- */
+
+*/
static
VOID
SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
PRTL_SPLAY_LINKS LinkB)
{
- if (RtlParent(LinkA) == LinkB || RtlIsRoot(LinkB)) {
+ if (RtlParent(LinkA) == LinkB || RtlIsRoot(LinkB))
+ {
PRTL_SPLAY_LINKS Tmp = LinkA;
LinkA = LinkB;
LinkB = Tmp;
{
RTL_SPLAY_LINKS Ta = *LinkA, Tb = *LinkB;
- BOOLEAN RootA = RtlIsRoot(LinkA),
- LeftA = RtlIsLeftChild(LinkA),
- LeftB = RtlIsLeftChild(LinkB);
+ BOOLEAN RootA = RtlIsRoot(LinkA),
+ LeftA = RtlIsLeftChild(LinkA),
+ LeftB = RtlIsLeftChild(LinkB);
+
*LinkB = Ta; *LinkA = Tb;
// A was parent of B is a special case: A->Parent is now B
- if (RtlParent(&Tb) == LinkA) {
- if (!RootA) {
- if (LeftA) {
+ if (RtlParent(&Tb) == LinkA)
+ {
+ if (!RootA)
+ {
+ if (LeftA)
RtlInsertAsLeftChild(RtlParent(&Ta), LinkB);
- } else {
+ else
RtlInsertAsRightChild(RtlParent(&Ta), LinkB);
- }
}
- if (LeftB) {
+
+ if (LeftB)
RtlInsertAsLeftChild(LinkB, LinkA);
- } else {
+ else
RtlInsertAsRightChild(LinkB, LinkA);
- }
}
FixupChildLinks(LinkA, FALSE, LeftB);
#ifdef VERIFY_SWAP_SPLAY_LINKS
// Verify the distinct cases of node swap
- if (RootA) {
- if (RtlParent(&Tb) == LinkA) {
+ if (RootA)
+ {
+ if (RtlParent(&Tb) == LinkA)
+ {
// LinkA = D, LinkB = B
// D B S S.L S.R S Q Q.R
ASSERT(RtlParent(LinkA) == LinkB);
ASSERT(RtlParent(LinkB) == LinkB);
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
- } else {
+ }
+ else
+ {
// LinkA = D, LinkB = A
// D A S.P S.L S.R S Q.L Q.R
ASSERT(RtlParent(LinkA) == RtlParent(&Tb));
ASSERT(RtlLeftChild(LinkB) == RtlLeftChild(&Ta));
ASSERT(RtlRightChild(LinkB) == RtlRightChild(&Ta));
}
- } else {
- if (RtlParent(&Tb) == LinkA) {
+ }
+ else
+ {
+ if (RtlParent(&Tb) == LinkA)
+ {
// LinkA = B, LinkB = A
// B A S S.L S.R Q.P Q Q.R
ASSERT(RtlParent(LinkA) == LinkB);
ASSERT(RtlParent(LinkB) == RtlParent(&Ta));
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
- } else {
+ }
+ else
+ {
// LinkA = A, LinkB = C
// A C S.P S.L S.R Q.P Q.L Q.R
ASSERT(!memcmp(LinkA, &Tb, sizeof(Tb)));
}
/*
-* @implemented
-*/
+ * @implemented
+ */
PRTL_SPLAY_LINKS
NTAPI
RtlRealPredecessor(PRTL_SPLAY_LINKS Links)
}
/*
-* @implemented
-*/
+ * @implemented
+ */
PRTL_SPLAY_LINKS
NTAPI
RtlRealSuccessor(PRTL_SPLAY_LINKS Links)
}
/*
-* @implemented
-*/
+ * @implemented
+ */
PRTL_SPLAY_LINKS
NTAPI
RtlSplay(PRTL_SPLAY_LINKS Links)
}
/*
-* @implemented
-*/
+ * @implemented
+ */
PRTL_SPLAY_LINKS
NTAPI
RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
}
/*
-* @implemented
-*/
+ * @implemented
+ */
PRTL_SPLAY_LINKS
NTAPI
RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)