mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
[RTL]
Remove pointless ASSERTs, instead set the balance of the new node to balanced, before inserting it. Dedicated to Alex. svn path=/trunk/; revision=56253
This commit is contained in:
parent
5ccd8f3e5c
commit
9a86915b40
1 changed files with 1 additions and 57 deletions
|
@ -203,45 +203,6 @@ RtlpRebalanceAvlTreeNode(IN PRTL_BALANCED_LINKS Node)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PRTL_BALANCED_LINKS
|
|
||||||
void
|
|
||||||
Indent(ULONG Level)
|
|
||||||
{
|
|
||||||
while (Level--)
|
|
||||||
{
|
|
||||||
DbgPrint(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
|
||||||
DbgDumpAvlNodes(
|
|
||||||
PRTL_BALANCED_LINKS Node,
|
|
||||||
ULONG Level)
|
|
||||||
{
|
|
||||||
if (Level == 0)
|
|
||||||
{
|
|
||||||
DbgPrint("++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
|
|
||||||
DbgPrint("Root = %p\n", Node);
|
|
||||||
}
|
|
||||||
|
|
||||||
Indent(Level+1); DbgPrint("LetChid = %p", Node->LeftChild);
|
|
||||||
if (Node->LeftChild)
|
|
||||||
{
|
|
||||||
DbgPrint("(%lx, %lx)\n", Node->LeftChild->StartingVpn,Node->LeftChild->EndingVpn);
|
|
||||||
DbgDumpAvlNodes(Node->LeftChild, Level+1);
|
|
||||||
}
|
|
||||||
else DbgPrint("\n");
|
|
||||||
Indent(Level+1); DbgPrint("RightChild = %p\n", Node->RightChild);
|
|
||||||
if (Node->RightChild)
|
|
||||||
{
|
|
||||||
DbgPrint("(%lx, %lx)\n", Node->RightChild->StartingVpn,Node->RightChild->EndingVpn);
|
|
||||||
DbgDumpAvlNodes(Node->RightChild, Level+1);
|
|
||||||
}
|
|
||||||
else DbgPrint("\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
RtlpInsertAvlTreeNode(IN PRTL_AVL_TABLE Table,
|
RtlpInsertAvlTreeNode(IN PRTL_AVL_TABLE Table,
|
||||||
|
@ -254,6 +215,7 @@ RtlpInsertAvlTreeNode(IN PRTL_AVL_TABLE Table,
|
||||||
/* Initialize the new inserted element */
|
/* Initialize the new inserted element */
|
||||||
MI_ASSERT(SearchResult != TableFoundNode);
|
MI_ASSERT(SearchResult != TableFoundNode);
|
||||||
NewNode->LeftChild = NewNode->RightChild = NULL;
|
NewNode->LeftChild = NewNode->RightChild = NULL;
|
||||||
|
RtlSetBalance(NewNode, RtlBalancedAvlTree);
|
||||||
|
|
||||||
/* Increase element count */
|
/* Increase element count */
|
||||||
Table->NumberGenericTableElements++;
|
Table->NumberGenericTableElements++;
|
||||||
|
@ -263,15 +225,6 @@ RtlpInsertAvlTreeNode(IN PRTL_AVL_TABLE Table,
|
||||||
{
|
{
|
||||||
/* This is the new root node */
|
/* This is the new root node */
|
||||||
RtlInsertAsRightChildAvl(&Table->BalancedRoot, NewNode);
|
RtlInsertAsRightChildAvl(&Table->BalancedRoot, NewNode);
|
||||||
//MI_ASSERT(RtlBalance(NewNode) == RtlBalancedAvlTree);
|
|
||||||
if (RtlBalance(NewNode) != RtlBalancedAvlTree)
|
|
||||||
{
|
|
||||||
DPRINT1("Warning: Root node unbalanced?\n");
|
|
||||||
#ifdef PRTL_BALANCED_LINKS
|
|
||||||
DbgDumpAvlNodes(&Table->BalancedRoot, 0);
|
|
||||||
KeRosDumpStackFrames(NULL, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On AVL trees, we also update the depth */
|
/* On AVL trees, we also update the depth */
|
||||||
ASSERT(Table->DepthOfTree == 0);
|
ASSERT(Table->DepthOfTree == 0);
|
||||||
|
@ -290,15 +243,6 @@ RtlpInsertAvlTreeNode(IN PRTL_AVL_TABLE Table,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Little cheat to save on loop processing, taken from Timo */
|
/* Little cheat to save on loop processing, taken from Timo */
|
||||||
//MI_ASSERT(RtlBalance(NewNode) == RtlBalancedAvlTree);
|
|
||||||
if (RtlBalance(NewNode) != RtlBalancedAvlTree)
|
|
||||||
{
|
|
||||||
DPRINT1("Warning: Root node unbalanced?\n");
|
|
||||||
#ifdef PRTL_BALANCED_LINKS
|
|
||||||
DbgDumpAvlNodes(&Table->BalancedRoot, 0);
|
|
||||||
KeRosDumpStackFrames(NULL, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
RtlSetBalance(&Table->BalancedRoot, RtlLeftHeavyAvlTree);
|
RtlSetBalance(&Table->BalancedRoot, RtlLeftHeavyAvlTree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue