diff options
author | David Robillard <d@drobilla.net> | 2020-08-13 17:26:00 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-08-13 17:26:00 +0200 |
commit | 4215a8ab7cc004c617b91a1628dbad3f19fbbe30 (patch) | |
tree | fbd27e5d1dd2e185a7bb9b054091cb47cea5c3fe /zix | |
parent | d86638c91f89187f72afc532baf565ded0a29b7f (diff) | |
download | zix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.tar.gz zix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.tar.bz2 zix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.zip |
Shrink some code
Diffstat (limited to 'zix')
-rw-r--r-- | zix/ring.c | 4 | ||||
-rw-r--r-- | zix/thread.h | 14 |
2 files changed, 7 insertions, 11 deletions
@@ -173,9 +173,9 @@ zix_ring_read(ZixRing* ring, void* dst, uint32_t size) ZIX_READ_BARRIER(); ring->read_head = (r + size) & ring->size_mask; return size; - } else { - return 0; } + + return 0; } uint32_t diff --git a/zix/thread.h b/zix/thread.h index 2af0c5e..e2b59c4 100644 --- a/zix/thread.h +++ b/zix/thread.h @@ -101,17 +101,13 @@ zix_thread_create(ZixThread* thread, const int ret = pthread_create(thread, NULL, function, arg); pthread_attr_destroy(&attr); - if (ret == EAGAIN) { - return ZIX_STATUS_NO_MEM; - } else if (ret == EINVAL) { - return ZIX_STATUS_BAD_ARG; - } else if (ret == EPERM) { - return ZIX_STATUS_BAD_PERMS; - } else if (ret) { - return ZIX_STATUS_ERROR; + switch (ret) { + case EAGAIN: return ZIX_STATUS_NO_MEM; + case EINVAL: return ZIX_STATUS_BAD_ARG; + case EPERM: return ZIX_STATUS_BAD_PERMS; } - return ZIX_STATUS_SUCCESS; + return ret ? ZIX_STATUS_ERROR : ZIX_STATUS_SUCCESS; } static inline ZixStatus |