mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 09:13:00 +00:00
Fixed avl tree completely.
- We can't use the builtin node as a sentinel in exactly the same way as used in the austin lib, so we account for that by treating the builtin node like nil a few places. svn path=/trunk/; revision=24510
This commit is contained in:
parent
8e756fbebc
commit
789a033291
4 changed files with 75 additions and 14 deletions
|
@ -132,6 +132,8 @@ RtlDeleteElementGenericTableAvl (
|
|||
{
|
||||
avl_delete_node(Table, Node);
|
||||
Table->FreeRoutine(Table, Node);
|
||||
if( Table->NumberGenericTableElements == 0 )
|
||||
avl_deinit(Table);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -303,7 +305,6 @@ RtlInitializeGenericTableAvl(IN OUT PRTL_AVL_TABLE Table,
|
|||
Table->AllocateRoutine = AllocateRoutine;
|
||||
Table->FreeRoutine = FreeRoutine;
|
||||
Table->TableContext = TableContext;
|
||||
avl_init(Table);
|
||||
}
|
||||
|
||||
|
||||
|
@ -358,6 +359,10 @@ RtlInsertElementGenericTableFullAvl (
|
|||
PRTL_BALANCED_LINKS OurNodeOrParent;
|
||||
TABLE_SEARCH_RESULT OurSearchResult;
|
||||
|
||||
if(Table->NumberGenericTableElements == 0) {
|
||||
avl_init(Table);
|
||||
}
|
||||
|
||||
if(NewElement)
|
||||
*NewElement = FALSE;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue