use loops instead of gotos
Modified: trunk/reactos/lib/kernel32/synch/wait.c
_____
Modified: trunk/reactos/lib/kernel32/synch/wait.c
--- trunk/reactos/lib/kernel32/synch/wait.c 2005-08-07 23:43:58 UTC
(rev 17191)
+++ trunk/reactos/lib/kernel32/synch/wait.c 2005-08-08 00:45:04 UTC
(rev 17192)
@@ -90,18 +90,21 @@
Time.QuadPart = -10000 * (LONGLONG)dwMilliseconds;
TimePtr = &Time;
}
-WaitAgain:
- Status = NtWaitForSingleObject(hHandle,
- (BOOLEAN) bAlertable,
- TimePtr);
- if (HIWORD(Status))
+ do
{
- SetLastErrorByStatus (Status);
- return WAIT_FAILED;
- }
- if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
+ Status = NtWaitForSingleObject(hHandle,
+ (BOOLEAN) bAlertable,
+ TimePtr);
+ if (HIWORD(Status))
+ {
+ SetLastErrorByStatus (Status);
+ return WAIT_FAILED;
+ }
+
+ } while (Status == STATUS_ALERTED && bAlertable);
+
return Status;
}
@@ -211,19 +214,21 @@
TimePtr = &Time;
}
-WaitAgain:
- Status = NtWaitForMultipleObjects (nCount,
- HandleBuffer,
- bWaitAll ? WaitAll : WaitAny,
- (BOOLEAN)bAlertable,
- TimePtr);
- if (HIWORD(Status))
+ do
{
- SetLastErrorByStatus (Status);
- Status = WAIT_FAILED;
- }
- if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
+ Status = NtWaitForMultipleObjects (nCount,
+ HandleBuffer,
+ bWaitAll ? WaitAll : WaitAny,
+ (BOOLEAN)bAlertable,
+ TimePtr);
+ if (HIWORD(Status))
+ {
+ SetLastErrorByStatus (Status);
+ Status = WAIT_FAILED;
+ }
+ } while (Status == STATUS_ALERTED && bAlertable);
+
if (HandleBuffer != Handle)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer);
@@ -283,18 +288,20 @@
TimePtr = &Time;
}
-WaitAgain:
- Status = NtSignalAndWaitForSingleObject (hObjectToSignal,
- hObjectToWaitOn,
- (BOOLEAN)bAlertable,
- TimePtr);
- if (!NT_SUCCESS(Status))
+ do
{
- SetLastErrorByStatus (Status);
- return WAIT_FAILED;
- }
- if (Status == STATUS_ALERTED && bAlertable) goto WaitAgain;
+ Status = NtSignalAndWaitForSingleObject (hObjectToSignal,
+ hObjectToWaitOn,
+ (BOOLEAN)bAlertable,
+ TimePtr);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus (Status);
+ return WAIT_FAILED;
+ }
+ } while (Status == STATUS_ALERTED && bAlertable);
+
/* STATUS_SUCCESS maps to WAIT_OBJECT_0 */
return Status;
}