diff options
author | Chris Robinson <[email protected]> | 2018-02-01 19:11:23 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-02-01 19:11:23 -0800 |
commit | 3a90fd575146a61d199014fda6b6420161575f41 (patch) | |
tree | 4c628a8e64bb815c8fc09b4d7fb629a149bd3aa9 /common/threads.c | |
parent | ec14c98f2d7c2a01f62a2fcebf1d9479cb540a0d (diff) |
Avoid an unnecessary temp variable
Diffstat (limited to 'common/threads.c')
-rw-r--r-- | common/threads.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/common/threads.c b/common/threads.c index c1b062cd..999bb768 100644 --- a/common/threads.c +++ b/common/threads.c @@ -751,8 +751,8 @@ void alcnd_destroy(alcnd_t *cond) int alsem_init(alsem_t *sem, unsigned int initial) { - int ret = sem_init(sem, 0, initial); - if(ret == 0) return althrd_success; + if(sem_init(sem, 0, initial) == 0) + return althrd_success; return althrd_error; } @@ -763,23 +763,21 @@ void alsem_destroy(alsem_t *sem) int alsem_post(alsem_t *sem) { - int ret = sem_post(sem); - if(ret == 0) return althrd_success; + if(sem_post(sem) == 0) + return althrd_success; return althrd_error; } int alsem_wait(alsem_t *sem) { - int ret = sem_wait(sem); - if(ret == 0) return althrd_success; + if(sem_wait(sem) == 0) return althrd_success; if(errno == EINTR) return -2; return althrd_error; } int alsem_timedwait(alsem_t *sem, const struct timespec *time_point) { - int ret = sem_timedwait(sem, time_point); - if(ret == 0) return althrd_success; + if(sem_timedwait(sem, time_point) == 0) return althrd_success; if(errno == ETIMEDOUT) return althrd_timedout; if(errno == EINTR) return -2; return althrd_error; |