- Apply similar fixes as in 58848 to RtlGetElementGenericTable (no need to make too fancy predecrements if they work incorrectly in this case when do/while loops were unnecessary at all).

svn path=/trunk/; revision=58850
This commit is contained in:
Aleksey Bragin 2013-04-25 14:15:10 +00:00
parent f6d5d2eb5d
commit a47024fcd7

View file

@ -451,21 +451,23 @@ RtlGetElementGenericTable(IN PRTL_GENERIC_TABLE Table,
{
/* Do the search backwards, since this takes less iterations */
DeltaDown = OrderedElement - NextI;
do
while (DeltaDown)
{
/* Get next node */
OrderedNode = OrderedNode->Blink;
} while (--DeltaDown);
DeltaDown--;
}
}
else
{
/* Follow the list directly instead */
OrderedNode = &Table->InsertOrderList;
do
while (NextI)
{
/* Get next node */
OrderedNode = OrderedNode->Flink;
} while (--NextI);
NextI--;
}
}
}
else
@ -478,21 +480,23 @@ RtlGetElementGenericTable(IN PRTL_GENERIC_TABLE Table,
if (DeltaUp <= DeltaDown)
{
/* Do the search forwards, since this takes less iterations */
do
while (DeltaUp)
{
/* Get next node */
OrderedNode = OrderedNode->Blink;
} while (--DeltaUp);
DeltaUp--;
}
}
else
{
/* Do the search downwards, since this takes less iterations */
OrderedNode = &Table->InsertOrderList;
do
while (DeltaDown)
{
/* Get next node */
OrderedNode = OrderedNode->Blink;
} while (--DeltaDown);
DeltaDown--;
}
}
}