From 287eb6026f85acb80d88b488146adab361098551 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 27 Mar 2024 11:17:26 +0100 Subject: [PATCH] thread/posix: optimize handler and fix gcc arm32 warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes (on arm32 gcc): warning: cast from function call of type ‘int’ to non-matching type ‘void *’ [-Wbad-function-cast] --- src/thread/posix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/thread/posix.c b/src/thread/posix.c index 7cc3822ff..6a70cac84 100644 --- a/src/thread/posix.c +++ b/src/thread/posix.c @@ -16,11 +16,12 @@ struct thread { static void *handler(void *p) { - struct thread th = *(struct thread *)p; + struct thread *th = p; - mem_deref(p); + int ret = th->func(th->arg); + mem_deref(th); - return (void *)(intptr_t)th.func(th.arg); + return (void *)(intptr_t)ret; }