mirror of
https://github.com/reactos/reactos.git
synced 2024-10-03 07:53:49 +00:00
improve readability by removing obsolete gotos and for loops where appropriate
svn path=/trunk/; revision=14267
This commit is contained in:
parent
2700763b70
commit
c0b7a5108d
|
@ -250,7 +250,7 @@ KeWaitForSingleObject(PVOID Object,
|
||||||
/* It has a normal signal state, so unwait it and return */
|
/* It has a normal signal state, so unwait it and return */
|
||||||
KiSatisfyObjectWait(CurrentObject, CurrentThread);
|
KiSatisfyObjectWait(CurrentObject, CurrentThread);
|
||||||
Status = STATUS_WAIT_0;
|
Status = STATUS_WAIT_0;
|
||||||
goto WaitDone;
|
break;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ KeWaitForSingleObject(PVOID Object,
|
||||||
|
|
||||||
/* Return a timeout */
|
/* Return a timeout */
|
||||||
Status = STATUS_TIMEOUT;
|
Status = STATUS_TIMEOUT;
|
||||||
goto WaitDone;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Point to Timer Wait Block and Thread Timer */
|
/* Point to Timer Wait Block and Thread Timer */
|
||||||
|
@ -311,7 +311,7 @@ KeWaitForSingleObject(PVOID Object,
|
||||||
|
|
||||||
/* Return a timeout if we couldn't insert the timer for some reason */
|
/* Return a timeout if we couldn't insert the timer for some reason */
|
||||||
Status = STATUS_TIMEOUT;
|
Status = STATUS_TIMEOUT;
|
||||||
goto WaitDone;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,6 @@ KeWaitForSingleObject(PVOID Object,
|
||||||
|
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
|
|
||||||
WaitDone:
|
|
||||||
/* Release the Lock, we are done */
|
/* Release the Lock, we are done */
|
||||||
DPRINT("Returning from KeWaitForMultipleObjects(), %x. Status: %d\n", KeGetCurrentThread(), Status);
|
DPRINT("Returning from KeWaitForMultipleObjects(), %x. Status: %d\n", KeGetCurrentThread(), Status);
|
||||||
KeReleaseDispatcherDatabaseLock(CurrentThread->WaitIrql);
|
KeReleaseDispatcherDatabaseLock(CurrentThread->WaitIrql);
|
||||||
|
@ -369,7 +368,7 @@ KeWaitForMultipleObjects(ULONG Count,
|
||||||
PKWAIT_BLOCK TimerWaitBlock;
|
PKWAIT_BLOCK TimerWaitBlock;
|
||||||
PKTIMER ThreadTimer;
|
PKTIMER ThreadTimer;
|
||||||
PKTHREAD CurrentThread = KeGetCurrentThread();
|
PKTHREAD CurrentThread = KeGetCurrentThread();
|
||||||
ULONG AllObjectsSignaled;
|
BOOLEAN AllObjectsSignaled;
|
||||||
ULONG WaitIndex;
|
ULONG WaitIndex;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
NTSTATUS WaitStatus;
|
NTSTATUS WaitStatus;
|
||||||
|
@ -507,7 +506,7 @@ KeWaitForMultipleObjects(ULONG Count,
|
||||||
/* Satisfy their Waits and return to the caller */
|
/* Satisfy their Waits and return to the caller */
|
||||||
KiSatisifyMultipleObjectWaits(WaitBlock);
|
KiSatisifyMultipleObjectWaits(WaitBlock);
|
||||||
Status = STATUS_WAIT_0;
|
Status = STATUS_WAIT_0;
|
||||||
goto WaitDone;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we can satisfy the Alertable request */
|
/* Make sure we can satisfy the Alertable request */
|
||||||
|
@ -524,7 +523,7 @@ KeWaitForMultipleObjects(ULONG Count,
|
||||||
|
|
||||||
/* Return a timeout */
|
/* Return a timeout */
|
||||||
Status = STATUS_TIMEOUT;
|
Status = STATUS_TIMEOUT;
|
||||||
goto WaitDone;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Point to Timer Wait Block and Thread Timer */
|
/* Point to Timer Wait Block and Thread Timer */
|
||||||
|
@ -549,22 +548,20 @@ KeWaitForMultipleObjects(ULONG Count,
|
||||||
|
|
||||||
/* Return a timeout if we couldn't insert the timer for some reason */
|
/* Return a timeout if we couldn't insert the timer for some reason */
|
||||||
Status = STATUS_TIMEOUT;
|
Status = STATUS_TIMEOUT;
|
||||||
goto WaitDone;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert into Object's Wait List*/
|
/* Insert into Object's Wait List*/
|
||||||
WaitBlock = CurrentThread->WaitBlockList;
|
for (WaitBlock = CurrentThread->WaitBlockList;
|
||||||
while (WaitBlock) {
|
WaitBlock != NULL;
|
||||||
|
WaitBlock = WaitBlock->NextWaitBlock) {
|
||||||
|
|
||||||
/* Get the Current Object */
|
/* Get the Current Object */
|
||||||
CurrentObject = WaitBlock->Object;
|
CurrentObject = WaitBlock->Object;
|
||||||
|
|
||||||
/* Link the Object to this Wait Block */
|
/* Link the Object to this Wait Block */
|
||||||
InsertTailList(&CurrentObject->WaitListHead, &WaitBlock->WaitListEntry);
|
InsertTailList(&CurrentObject->WaitListHead, &WaitBlock->WaitListEntry);
|
||||||
|
|
||||||
/* Move to the next Wait Block */
|
|
||||||
WaitBlock = WaitBlock->NextWaitBlock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle Kernel Queues */
|
/* Handle Kernel Queues */
|
||||||
|
@ -660,8 +657,10 @@ KiWaitTest(PDISPATCHER_HEADER Object,
|
||||||
/* Loop the Wait Entries */
|
/* Loop the Wait Entries */
|
||||||
DPRINT("KiWaitTest for Object: %x\n", Object);
|
DPRINT("KiWaitTest for Object: %x\n", Object);
|
||||||
WaitList = &Object->WaitListHead;
|
WaitList = &Object->WaitListHead;
|
||||||
WaitEntry = WaitList->Flink;
|
|
||||||
while ((WaitEntry != WaitList) && (Object->SignalState > 0)) {
|
for (WaitEntry = WaitList->Flink;
|
||||||
|
(WaitEntry != WaitList) && (Object->SignalState > 0);
|
||||||
|
WaitEntry = WaitEntry->Flink) {
|
||||||
|
|
||||||
/* Get the current wait block */
|
/* Get the current wait block */
|
||||||
CurrentWaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
|
CurrentWaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
|
||||||
|
@ -678,21 +677,19 @@ KiWaitTest(PDISPATCHER_HEADER Object,
|
||||||
|
|
||||||
/* Everything must be satisfied */
|
/* Everything must be satisfied */
|
||||||
DPRINT("Checking for a Wait All\n");
|
DPRINT("Checking for a Wait All\n");
|
||||||
NextWaitBlock = CurrentWaitBlock->NextWaitBlock;
|
|
||||||
|
|
||||||
/* Loop first to make sure they are valid */
|
/* Loop first to make sure they are valid */
|
||||||
while (NextWaitBlock) {
|
for (NextWaitBlock = CurrentWaitBlock->NextWaitBlock;
|
||||||
|
NextWaitBlock != NULL;
|
||||||
|
NextWaitBlock = NextWaitBlock->NextWaitBlock) {
|
||||||
|
|
||||||
/* Check if the object is signaled */
|
/* Check if the object is signaled */
|
||||||
if (!KiIsObjectSignaled(Object, CurrentWaitBlock->Thread)) {
|
if (!KiIsObjectSignaled(Object, CurrentWaitBlock->Thread)) {
|
||||||
|
|
||||||
/* It's not, move to the next one */
|
/* It's not, move to the next one */
|
||||||
DPRINT1("One of the object is non-signaled, sorry.\n");
|
DPRINT1("One of the object is non-signaled, sorry.\n");
|
||||||
goto SkipUnwait;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go to the next Wait block */
|
|
||||||
NextWaitBlock = NextWaitBlock->NextWaitBlock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All the objects are signaled, we can satisfy */
|
/* All the objects are signaled, we can satisfy */
|
||||||
|
@ -704,10 +701,6 @@ KiWaitTest(PDISPATCHER_HEADER Object,
|
||||||
/* All waits satisfied, unwait the thread */
|
/* All waits satisfied, unwait the thread */
|
||||||
DPRINT("Unwaiting the Thread\n");
|
DPRINT("Unwaiting the Thread\n");
|
||||||
KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment);
|
KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment);
|
||||||
|
|
||||||
SkipUnwait:
|
|
||||||
/* Next entry */
|
|
||||||
WaitEntry = WaitEntry->Flink;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Done\n");
|
DPRINT("Done\n");
|
||||||
|
@ -728,15 +721,14 @@ KiAbortWaitThread(PKTHREAD Thread,
|
||||||
|
|
||||||
/* Remove the Wait Blocks from the list */
|
/* Remove the Wait Blocks from the list */
|
||||||
DPRINT("Removing waits\n");
|
DPRINT("Removing waits\n");
|
||||||
WaitBlock = Thread->WaitBlockList;
|
|
||||||
while (WaitBlock) {
|
for (WaitBlock = Thread->WaitBlockList;
|
||||||
|
WaitBlock != NULL;
|
||||||
|
WaitBlock = WaitBlock->NextWaitBlock) {
|
||||||
|
|
||||||
/* Remove it */
|
/* Remove it */
|
||||||
DPRINT("Removing Waitblock: %x, %x\n", WaitBlock, WaitBlock->NextWaitBlock);
|
DPRINT("Removing Waitblock: %x, %x\n", WaitBlock, WaitBlock->NextWaitBlock);
|
||||||
RemoveEntryList(&WaitBlock->WaitListEntry);
|
RemoveEntryList(&WaitBlock->WaitListEntry);
|
||||||
|
|
||||||
/* Go to the next one */
|
|
||||||
WaitBlock = WaitBlock->NextWaitBlock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Check if there's a Thread Timer */
|
/* Check if there's a Thread Timer */
|
||||||
|
|
Loading…
Reference in a new issue