mirror of
https://github.com/reactos/reactos.git
synced 2024-11-19 05:22:59 +00:00
[RTL]
- 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:
parent
f6d5d2eb5d
commit
a47024fcd7
1 changed files with 12 additions and 8 deletions
|
@ -451,21 +451,23 @@ RtlGetElementGenericTable(IN PRTL_GENERIC_TABLE Table,
|
||||||
{
|
{
|
||||||
/* Do the search backwards, since this takes less iterations */
|
/* Do the search backwards, since this takes less iterations */
|
||||||
DeltaDown = OrderedElement - NextI;
|
DeltaDown = OrderedElement - NextI;
|
||||||
do
|
while (DeltaDown)
|
||||||
{
|
{
|
||||||
/* Get next node */
|
/* Get next node */
|
||||||
OrderedNode = OrderedNode->Blink;
|
OrderedNode = OrderedNode->Blink;
|
||||||
} while (--DeltaDown);
|
DeltaDown--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Follow the list directly instead */
|
/* Follow the list directly instead */
|
||||||
OrderedNode = &Table->InsertOrderList;
|
OrderedNode = &Table->InsertOrderList;
|
||||||
do
|
while (NextI)
|
||||||
{
|
{
|
||||||
/* Get next node */
|
/* Get next node */
|
||||||
OrderedNode = OrderedNode->Flink;
|
OrderedNode = OrderedNode->Flink;
|
||||||
} while (--NextI);
|
NextI--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -478,21 +480,23 @@ RtlGetElementGenericTable(IN PRTL_GENERIC_TABLE Table,
|
||||||
if (DeltaUp <= DeltaDown)
|
if (DeltaUp <= DeltaDown)
|
||||||
{
|
{
|
||||||
/* Do the search forwards, since this takes less iterations */
|
/* Do the search forwards, since this takes less iterations */
|
||||||
do
|
while (DeltaUp)
|
||||||
{
|
{
|
||||||
/* Get next node */
|
/* Get next node */
|
||||||
OrderedNode = OrderedNode->Blink;
|
OrderedNode = OrderedNode->Blink;
|
||||||
} while (--DeltaUp);
|
DeltaUp--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Do the search downwards, since this takes less iterations */
|
/* Do the search downwards, since this takes less iterations */
|
||||||
OrderedNode = &Table->InsertOrderList;
|
OrderedNode = &Table->InsertOrderList;
|
||||||
do
|
while (DeltaDown)
|
||||||
{
|
{
|
||||||
/* Get next node */
|
/* Get next node */
|
||||||
OrderedNode = OrderedNode->Blink;
|
OrderedNode = OrderedNode->Blink;
|
||||||
} while (--DeltaDown);
|
DeltaDown--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue