Author: hbelusca Date: Sat Oct 18 23:59:25 2014 New Revision: 64819
URL: http://svn.reactos.org/svn/reactos?rev=64819&view=rev Log: Fix whitespace, and get rid of that sh*tty K&R style.
Modified: trunk/reactos/lib/rtl/splaytree.c
Modified: trunk/reactos/lib/rtl/splaytree.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/splaytree.c?rev=648... ============================================================================== --- trunk/reactos/lib/rtl/splaytree.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/splaytree.c [iso-8859-1] Sat Oct 18 23:59:25 2014 @@ -21,18 +21,18 @@ 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); - } } }
@@ -57,14 +57,16 @@ 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; @@ -72,25 +74,27 @@
{ 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); @@ -102,8 +106,10 @@
#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); @@ -112,7 +118,9 @@ 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)); @@ -122,8 +130,11 @@ 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); @@ -132,7 +143,9 @@ 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))); @@ -323,8 +336,8 @@ }
/* -* @implemented -*/ + * @implemented + */ PRTL_SPLAY_LINKS NTAPI RtlRealPredecessor(PRTL_SPLAY_LINKS Links) @@ -352,8 +365,8 @@ }
/* -* @implemented -*/ + * @implemented + */ PRTL_SPLAY_LINKS NTAPI RtlRealSuccessor(PRTL_SPLAY_LINKS Links) @@ -381,8 +394,8 @@ }
/* -* @implemented -*/ + * @implemented + */ PRTL_SPLAY_LINKS NTAPI RtlSplay(PRTL_SPLAY_LINKS Links) @@ -725,8 +738,8 @@ }
/* -* @implemented -*/ + * @implemented + */ PRTL_SPLAY_LINKS NTAPI RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links) @@ -745,8 +758,8 @@ }
/* -* @implemented -*/ + * @implemented + */ PRTL_SPLAY_LINKS NTAPI RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)