- 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 */ /* 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--;
}
} }
} }