Shorten some AVL tree code

git-svn-id: svn://svn.code.sf.net/p/processhacker/code@6344 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
wj32
2016-01-30 11:37:57 +00:00
parent c189f3576c
commit fbc3d85271
3 changed files with 4 additions and 24 deletions
+2 -10
View File
@@ -382,9 +382,7 @@ VOID PhpExecuteCallbackForAllPlugins(
{
PPH_AVL_LINKS links;
links = PhMinimumElementAvlTree(&PhPluginsByName);
while (links)
for (links = PhMinimumElementAvlTree(&PhPluginsByName); links; links = PhSuccessorElementAvlTree(links))
{
PPH_PLUGIN plugin = CONTAINING_RECORD(links, PH_PLUGIN, Links);
PPH_LIST parameters = NULL;
@@ -416,15 +414,9 @@ VOID PhpExecuteCallbackForAllPlugins(
if (parameters)
{
ULONG i;
for (i = 0; i < parameters->Count; i++)
PhDereferenceObject(parameters->Items[i]);
PhDereferenceObjects(parameters->Items, parameters->Count);
PhDereferenceObject(parameters);
}
links = PhSuccessorElementAvlTree(links);
}
}
+2 -10
View File
@@ -164,9 +164,7 @@ BOOLEAN PhpIsPluginLoadedByBaseName(
// Extremely inefficient code follows.
// TODO: Make this better.
links = PhMinimumElementAvlTree(&PhPluginsByName);
while (links)
for (links = PhMinimumElementAvlTree(&PhPluginsByName); links; links = PhSuccessorElementAvlTree(links))
{
PPH_PLUGIN plugin = CONTAINING_RECORD(links, PH_PLUGIN, Links);
PH_STRINGREF pluginBaseName;
@@ -175,8 +173,6 @@ BOOLEAN PhpIsPluginLoadedByBaseName(
if (PhEqualStringRef(&pluginBaseName, BaseName, TRUE))
return TRUE;
links = PhSuccessorElementAvlTree(links);
}
return FALSE;
@@ -308,9 +304,7 @@ INT_PTR CALLBACK PhpPluginsDlgProc(
DisabledPluginLookup = PhCreateSimpleHashtable(10);
links = PhMinimumElementAvlTree(&PhPluginsByName);
while (links)
for (links = PhMinimumElementAvlTree(&PhPluginsByName); links; links = PhSuccessorElementAvlTree(links))
{
PPH_PLUGIN plugin = CONTAINING_RECORD(links, PH_PLUGIN, Links);
INT lvItemIndex;
@@ -327,8 +321,6 @@ INT_PTR CALLBACK PhpPluginsDlgProc(
if (PhIsPluginDisabled(&baseNameSr))
PhAddItemSimpleHashtable(DisabledPluginLookup, plugin, NULL);
links = PhSuccessorElementAvlTree(links);
}
DisabledPluginInstances = PhCreateList(10);
-4
View File
@@ -63,7 +63,6 @@ FORCEINLINE PPH_AVL_LINKS PhpFindElementAvlTree(
if (!links)
{
*Result = 1;
return &Tree->Root;
}
@@ -74,7 +73,6 @@ FORCEINLINE PPH_AVL_LINKS PhpFindElementAvlTree(
if (result == 0)
{
*Result = 0;
return links;
}
else if (result < 0)
@@ -86,7 +84,6 @@ FORCEINLINE PPH_AVL_LINKS PhpFindElementAvlTree(
else
{
*Result = -1;
return links;
}
}
@@ -99,7 +96,6 @@ FORCEINLINE PPH_AVL_LINKS PhpFindElementAvlTree(
else
{
*Result = 1;
return links;
}
}