From 6805ac371836bdb1114869cdf4e229cde248ff97 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sat, 10 Oct 2009 15:21:41 +0000 Subject: 2009-10-10 Joel Sherrill * posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/semtimedwait.c: Switch from switch to if's because only one value needed to be tested. This shrinks the code and makes it easier to do coverage analysis on. --- cpukit/posix/src/prwlocktimedwrlock.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'cpukit/posix/src/prwlocktimedwrlock.c') diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c index 62c0b2c911..bb45b1d669 100644 --- a/cpukit/posix/src/prwlocktimedwrlock.c +++ b/cpukit/posix/src/prwlocktimedwrlock.c @@ -43,7 +43,7 @@ int pthread_rwlock_timedwrlock( POSIX_RWLock_Control *the_rwlock; Objects_Locations location; Watchdog_Interval ticks; - bool do_wait; + bool do_wait = true; POSIX_Absolute_timeout_conversion_results_t status; if ( !rwlock ) @@ -57,19 +57,14 @@ int pthread_rwlock_timedwrlock( * is valid or not. If it isn't correct and in the future, * then we do a polling operation and convert the UNSATISFIED * status into the appropriate error. + * + * If the status is POSIX_ABSOLUTE_TIMEOUT_INVALID, + * POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST, or POSIX_ABSOLUTE_TIMEOUT_IS_NOW, + * then we should not wait. */ status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ); - switch (status) { - case POSIX_ABSOLUTE_TIMEOUT_INVALID: - case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST: - case POSIX_ABSOLUTE_TIMEOUT_IS_NOW: - do_wait = false; - break; - case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE: - default: /* only to silence warnings */ - do_wait = true; - break; - } + if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE ) + do_wait = false; the_rwlock = _POSIX_RWLock_Get( rwlock, &location ); switch ( location ) { -- cgit v1.2.3