mirror of
https://github.com/reactos/reactos.git
synced 2025-07-14 05:14:14 +00:00
- Fix RtlSubtreePredecessor/Successor, someone had implemented them backwards.
svn path=/trunk/; revision=19080
This commit is contained in:
parent
b3259fa7d8
commit
767d56a1d3
1 changed files with 22 additions and 27 deletions
|
@ -411,48 +411,43 @@ RtlSplay(PRTL_SPLAY_LINKS Links)
|
||||||
return N;
|
return N;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS NTAPI
|
PRTL_SPLAY_LINKS
|
||||||
|
NTAPI
|
||||||
RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
|
RtlSubtreePredecessor(IN PRTL_SPLAY_LINKS Links)
|
||||||
{
|
{
|
||||||
PRTL_SPLAY_LINKS Child;
|
PRTL_SPLAY_LINKS Child;
|
||||||
|
|
||||||
Child = Links->RightChild;
|
/* Get the left child */
|
||||||
if (Child == NULL)
|
Child = RtlLeftChild(Links);
|
||||||
return NULL;
|
if (!Child) return NULL;
|
||||||
|
|
||||||
if (Child->LeftChild == NULL)
|
/* Get right-most child */
|
||||||
return Child;
|
while (RtlRightChild(Child)) Child = RtlRightChild(Child);
|
||||||
|
|
||||||
/* Get left-most child */
|
|
||||||
while (Child->LeftChild != NULL)
|
|
||||||
Child = Child->LeftChild;
|
|
||||||
|
|
||||||
|
/* Return it */
|
||||||
return Child;
|
return Child;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PRTL_SPLAY_LINKS NTAPI
|
PRTL_SPLAY_LINKS
|
||||||
|
NTAPI
|
||||||
RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)
|
RtlSubtreeSuccessor(IN PRTL_SPLAY_LINKS Links)
|
||||||
{
|
{
|
||||||
PRTL_SPLAY_LINKS Child;
|
PRTL_SPLAY_LINKS Child;
|
||||||
|
|
||||||
Child = Links->LeftChild;
|
/* Get the right child */
|
||||||
if (Child == NULL)
|
Child = RtlRightChild(Links);
|
||||||
return NULL;
|
if (!Child) return NULL;
|
||||||
|
|
||||||
if (Child->RightChild == NULL)
|
/* Get left-most child */
|
||||||
return Child;
|
while (RtlLeftChild(Child)) Child = RtlLeftChild(Child);
|
||||||
|
|
||||||
/* Get right-most child */
|
|
||||||
while (Child->RightChild != NULL)
|
|
||||||
Child = Child->RightChild;
|
|
||||||
|
|
||||||
|
/* Return it */
|
||||||
return Child;
|
return Child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue