summaryrefslogtreecommitdiffstats
path: root/zix
diff options
context:
space:
mode:
Diffstat (limited to 'zix')
-rw-r--r--zix/ring.c4
-rw-r--r--zix/thread.h14
2 files changed, 7 insertions, 11 deletions
diff --git a/zix/ring.c b/zix/ring.c
index a62d833..cdbcea8 100644
--- a/zix/ring.c
+++ b/zix/ring.c
@@ -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