Avoid unnecessary local variables

This commit is contained in:
Chris Robinson 2014-05-27 15:32:38 -07:00
parent f0b65aa6b7
commit fd62868c17

View File

@ -341,15 +341,15 @@ int alcnd_broadcast(alcnd_t *cond)
int alcnd_wait(alcnd_t *cond, almtx_t *mtx)
{
_int_alcnd_t *icond = cond->Ptr;
int res, last;
int res;
IncrementRef(&icond->wait_count);
LeaveCriticalSection(mtx);
res = WaitForMultipleObjects(2, icond->events, FALSE, INFINITE);
last = DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST;
if(last) ResetEvent(icond->events[BROADCAST]);
if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST)
ResetEvent(icond->events[BROADCAST]);
EnterCriticalSection(mtx);
return althrd_success;
@ -360,7 +360,7 @@ int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_poi
_int_alcnd_t *icond = cond->Ptr;
struct timespec curtime;
DWORD sleeptime;
int res, last;
int res;
if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC)
return althrd_error;
@ -372,8 +372,8 @@ int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_poi
res = WaitForMultipleObjects(2, icond->events, FALSE, sleeptime);
last = DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST;
if(last) ResetEvent(icond->events[BROADCAST]);
if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST)
ResetEvent(icond->events[BROADCAST]);
EnterCriticalSection(mtx);
return (res == WAIT_TIMEOUT) ? althrd_timedout : althrd_success;