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:
Art Yerkes 2006-10-14 17:29:41 +00:00
parent 8e756fbebc
commit 789a033291
4 changed files with 75 additions and 14 deletions

View file

@ -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;