Author: fireball
Date: Thu Apr 25 14:15:10 2013
New Revision: 58850
URL:
http://svn.reactos.org/svn/reactos?rev=58850&view=rev
Log:
[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).
Modified:
trunk/reactos/lib/rtl/generictable.c
Modified: trunk/reactos/lib/rtl/generictable.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/generictable.c?rev…
==============================================================================
--- trunk/reactos/lib/rtl/generictable.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/generictable.c [iso-8859-1] Thu Apr 25 14:15:10 2013
@@ -451,21 +451,23 @@
{
/* 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 @@
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--;
+ }
}
}