mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 12:08:55 +00:00
Fix whitespace, and get rid of that sh*tty K&R style.
svn path=/trunk/; revision=64819
This commit is contained in:
parent
eea6067270
commit
b858c18208
1 changed files with 50 additions and 37 deletions
|
@ -21,18 +21,18 @@ static
|
||||||
VOID
|
VOID
|
||||||
FixupChildLinks(PRTL_SPLAY_LINKS Links, BOOLEAN Root, BOOLEAN LeftChild)
|
FixupChildLinks(PRTL_SPLAY_LINKS Links, BOOLEAN Root, BOOLEAN LeftChild)
|
||||||
{
|
{
|
||||||
if (RtlLeftChild(Links)) {
|
if (RtlLeftChild(Links))
|
||||||
RtlInsertAsLeftChild(Links, RtlLeftChild(Links));
|
RtlInsertAsLeftChild(Links, RtlLeftChild(Links));
|
||||||
}
|
|
||||||
if (RtlRightChild(Links)) {
|
if (RtlRightChild(Links))
|
||||||
RtlInsertAsRightChild(Links, RtlRightChild(Links));
|
RtlInsertAsRightChild(Links, RtlRightChild(Links));
|
||||||
}
|
|
||||||
if (!Root) {
|
if (!Root)
|
||||||
if (LeftChild) {
|
{
|
||||||
|
if (LeftChild)
|
||||||
RtlInsertAsLeftChild(RtlParent(Links), Links);
|
RtlInsertAsLeftChild(RtlParent(Links), Links);
|
||||||
} else {
|
else
|
||||||
RtlInsertAsRightChild(RtlParent(Links), Links);
|
RtlInsertAsRightChild(RtlParent(Links), Links);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +57,16 @@ When Q is the immediate parent of S,
|
||||||
Set Q's parent to S, and the proper child ptr of S to Q
|
Set Q's parent to S, and the proper child ptr of S to Q
|
||||||
When Q is the root,
|
When Q is the root,
|
||||||
Set S's parent to S
|
Set S's parent to S
|
||||||
*/
|
|
||||||
|
*/
|
||||||
|
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
PRTL_SPLAY_LINKS LinkB)
|
PRTL_SPLAY_LINKS LinkB)
|
||||||
{
|
{
|
||||||
if (RtlParent(LinkA) == LinkB || RtlIsRoot(LinkB)) {
|
if (RtlParent(LinkA) == LinkB || RtlIsRoot(LinkB))
|
||||||
|
{
|
||||||
PRTL_SPLAY_LINKS Tmp = LinkA;
|
PRTL_SPLAY_LINKS Tmp = LinkA;
|
||||||
LinkA = LinkB;
|
LinkA = LinkB;
|
||||||
LinkB = Tmp;
|
LinkB = Tmp;
|
||||||
|
@ -72,25 +74,27 @@ SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
|
|
||||||
{
|
{
|
||||||
RTL_SPLAY_LINKS Ta = *LinkA, Tb = *LinkB;
|
RTL_SPLAY_LINKS Ta = *LinkA, Tb = *LinkB;
|
||||||
BOOLEAN RootA = RtlIsRoot(LinkA),
|
BOOLEAN RootA = RtlIsRoot(LinkA),
|
||||||
LeftA = RtlIsLeftChild(LinkA),
|
LeftA = RtlIsLeftChild(LinkA),
|
||||||
LeftB = RtlIsLeftChild(LinkB);
|
LeftB = RtlIsLeftChild(LinkB);
|
||||||
|
|
||||||
*LinkB = Ta; *LinkA = Tb;
|
*LinkB = Ta; *LinkA = Tb;
|
||||||
|
|
||||||
// A was parent of B is a special case: A->Parent is now B
|
// A was parent of B is a special case: A->Parent is now B
|
||||||
if (RtlParent(&Tb) == LinkA) {
|
if (RtlParent(&Tb) == LinkA)
|
||||||
if (!RootA) {
|
{
|
||||||
if (LeftA) {
|
if (!RootA)
|
||||||
|
{
|
||||||
|
if (LeftA)
|
||||||
RtlInsertAsLeftChild(RtlParent(&Ta), LinkB);
|
RtlInsertAsLeftChild(RtlParent(&Ta), LinkB);
|
||||||
} else {
|
else
|
||||||
RtlInsertAsRightChild(RtlParent(&Ta), LinkB);
|
RtlInsertAsRightChild(RtlParent(&Ta), LinkB);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (LeftB) {
|
|
||||||
|
if (LeftB)
|
||||||
RtlInsertAsLeftChild(LinkB, LinkA);
|
RtlInsertAsLeftChild(LinkB, LinkA);
|
||||||
} else {
|
else
|
||||||
RtlInsertAsRightChild(LinkB, LinkA);
|
RtlInsertAsRightChild(LinkB, LinkA);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FixupChildLinks(LinkA, FALSE, LeftB);
|
FixupChildLinks(LinkA, FALSE, LeftB);
|
||||||
|
@ -102,8 +106,10 @@ SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
|
|
||||||
#ifdef VERIFY_SWAP_SPLAY_LINKS
|
#ifdef VERIFY_SWAP_SPLAY_LINKS
|
||||||
// Verify the distinct cases of node swap
|
// Verify the distinct cases of node swap
|
||||||
if (RootA) {
|
if (RootA)
|
||||||
if (RtlParent(&Tb) == LinkA) {
|
{
|
||||||
|
if (RtlParent(&Tb) == LinkA)
|
||||||
|
{
|
||||||
// LinkA = D, LinkB = B
|
// LinkA = D, LinkB = B
|
||||||
// D B S S.L S.R S Q Q.R
|
// D B S S.L S.R S Q Q.R
|
||||||
ASSERT(RtlParent(LinkA) == LinkB);
|
ASSERT(RtlParent(LinkA) == LinkB);
|
||||||
|
@ -112,7 +118,9 @@ SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
ASSERT(RtlParent(LinkB) == LinkB);
|
ASSERT(RtlParent(LinkB) == LinkB);
|
||||||
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
|
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
|
||||||
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
|
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// LinkA = D, LinkB = A
|
// LinkA = D, LinkB = A
|
||||||
// D A S.P S.L S.R S Q.L Q.R
|
// D A S.P S.L S.R S Q.L Q.R
|
||||||
ASSERT(RtlParent(LinkA) == RtlParent(&Tb));
|
ASSERT(RtlParent(LinkA) == RtlParent(&Tb));
|
||||||
|
@ -122,8 +130,11 @@ SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
ASSERT(RtlLeftChild(LinkB) == RtlLeftChild(&Ta));
|
ASSERT(RtlLeftChild(LinkB) == RtlLeftChild(&Ta));
|
||||||
ASSERT(RtlRightChild(LinkB) == RtlRightChild(&Ta));
|
ASSERT(RtlRightChild(LinkB) == RtlRightChild(&Ta));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (RtlParent(&Tb) == LinkA) {
|
else
|
||||||
|
{
|
||||||
|
if (RtlParent(&Tb) == LinkA)
|
||||||
|
{
|
||||||
// LinkA = B, LinkB = A
|
// LinkA = B, LinkB = A
|
||||||
// B A S S.L S.R Q.P Q Q.R
|
// B A S S.L S.R Q.P Q Q.R
|
||||||
ASSERT(RtlParent(LinkA) == LinkB);
|
ASSERT(RtlParent(LinkA) == LinkB);
|
||||||
|
@ -132,7 +143,9 @@ SwapSplayLinks(PRTL_SPLAY_LINKS LinkA,
|
||||||
ASSERT(RtlParent(LinkB) == RtlParent(&Ta));
|
ASSERT(RtlParent(LinkB) == RtlParent(&Ta));
|
||||||
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
|
ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta)));
|
||||||
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
|
ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// LinkA = A, LinkB = C
|
// LinkA = A, LinkB = C
|
||||||
// A C S.P S.L S.R Q.P Q.L Q.R
|
// A C S.P S.L S.R Q.P Q.L Q.R
|
||||||
ASSERT(!memcmp(LinkA, &Tb, sizeof(Tb)));
|
ASSERT(!memcmp(LinkA, &Tb, sizeof(Tb)));
|
||||||
|
@ -323,8 +336,8 @@ RtlDeleteNoSplay(PRTL_SPLAY_LINKS Links,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS
|
PRTL_SPLAY_LINKS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlRealPredecessor(PRTL_SPLAY_LINKS Links)
|
RtlRealPredecessor(PRTL_SPLAY_LINKS Links)
|
||||||
|
@ -352,8 +365,8 @@ RtlRealPredecessor(PRTL_SPLAY_LINKS Links)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS
|
PRTL_SPLAY_LINKS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlRealSuccessor(PRTL_SPLAY_LINKS Links)
|
RtlRealSuccessor(PRTL_SPLAY_LINKS Links)
|
||||||
|
@ -381,8 +394,8 @@ RtlRealSuccessor(PRTL_SPLAY_LINKS Links)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS
|
PRTL_SPLAY_LINKS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSplay(PRTL_SPLAY_LINKS Links)
|
RtlSplay(PRTL_SPLAY_LINKS Links)
|
||||||
|
@ -725,8 +738,8 @@ RtlSplay(PRTL_SPLAY_LINKS Links)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS
|
PRTL_SPLAY_LINKS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
|
RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
|
||||||
|
@ -745,8 +758,8 @@ RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS
|
PRTL_SPLAY_LINKS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)
|
RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)
|
||||||
|
|
Loading…
Reference in a new issue