mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +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 */
|
||||
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--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue