summaryrefslogtreecommitdiffstats
path: root/zix/thread.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-13 17:26:00 +0200
committerDavid Robillard <d@drobilla.net>2020-08-13 17:26:00 +0200
commit4215a8ab7cc004c617b91a1628dbad3f19fbbe30 (patch)
treefbd27e5d1dd2e185a7bb9b054091cb47cea5c3fe /zix/thread.h
parentd86638c91f89187f72afc532baf565ded0a29b7f (diff)
downloadzix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.tar.gz
zix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.tar.bz2
zix-4215a8ab7cc004c617b91a1628dbad3f19fbbe30.zip
Shrink some code
Diffstat (limited to 'zix/thread.h')
-rw-r--r--zix/thread.h14
1 files changed, 5 insertions, 9 deletions
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