diff options
author | Haru <haru@dotalux.com> | 2014-07-10 15:38:09 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2014-07-11 08:42:50 +0200 |
commit | 8b4f35532c8fd7c7f0939756923fdaf14ee39531 (patch) | |
tree | 2a5a69e909538ecc81cdcd37b0dd74e0a046e021 /src/common/thread.c | |
parent | 3f3f2e7ec09087b57148a0fb229de26293c5a462 (diff) | |
download | hercules-8b4f35532c8fd7c7f0939756923fdaf14ee39531.tar.gz hercules-8b4f35532c8fd7c7f0939756923fdaf14ee39531.tar.bz2 hercules-8b4f35532c8fd7c7f0939756923fdaf14ee39531.tar.xz hercules-8b4f35532c8fd7c7f0939756923fdaf14ee39531.zip |
Removed unsafe pointer typedefs
- If a variable doesn't look like a pointer... Maybe it might be a
pointer after all. Please, give me back my '*' sign.
- See CERT DCL05-C.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/thread.c')
-rw-r--r-- | src/common/thread.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/common/thread.c b/src/common/thread.c index 933ee2c0e..d8e0dbf0a 100644 --- a/src/common/thread.c +++ b/src/common/thread.c @@ -98,7 +98,7 @@ void rathread_final(){ // gets called whenever a thread terminated .. -static void rat_thread_terminated(rAthread handle) { +static void rat_thread_terminated(rAthread *handle) { // Preserve handle->myID and handle->hThread, set everything else to its default value handle->param = NULL; handle->proc = NULL; @@ -115,7 +115,7 @@ static void *_raThreadMainRedirector( void *p ){ // Update myID @ TLS to right id. #ifdef HAS_TLS - g_rathread_ID = ((rAthread)p)->myID; + g_rathread_ID = ((rAthread*)p)->myID; #endif #ifndef WIN32 @@ -133,13 +133,13 @@ static void *_raThreadMainRedirector( void *p ){ #endif - ret = ((rAthread)p)->proc( ((rAthread)p)->param ) ; + ret = ((rAthread*)p)->proc( ((rAthread*)p)->param ) ; #ifdef WIN32 - CloseHandle( ((rAthread)p)->hThread ); + CloseHandle( ((rAthread*)p)->hThread ); #endif - rat_thread_terminated( (rAthread)p ); + rat_thread_terminated( (rAthread*)p ); #ifdef WIN32 return (DWORD)ret; #else @@ -154,18 +154,18 @@ static void *_raThreadMainRedirector( void *p ){ /// /// API Level /// -rAthread rathread_create( rAthreadProc entryPoint, void *param ){ +rAthread *rathread_create(rAthreadProc entryPoint, void *param) { return rathread_createEx( entryPoint, param, (1<<23) /*8MB*/, RAT_PRIO_NORMAL ); }//end: rathread_create() -rAthread rathread_createEx( rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio ){ +rAthread *rathread_createEx(rAthreadProc entryPoint, void *param, size_t szStack, RATHREAD_PRIO prio) { #ifndef WIN32 pthread_attr_t attr; #endif size_t tmp; unsigned int i; - rAthread handle = NULL; + rAthread *handle = NULL; // given stacksize aligned to systems pagesize? @@ -212,7 +212,7 @@ rAthread rathread_createEx( rAthreadProc entryPoint, void *param, size_t szSta }//end: rathread_createEx -void rathread_destroy ( rAthread handle ){ +void rathread_destroy(rAthread *handle) { #ifdef WIN32 if( TerminateThread(handle->hThread, 0) != FALSE){ CloseHandle(handle->hThread); @@ -230,9 +230,9 @@ void rathread_destroy ( rAthread handle ){ #endif }//end: rathread_destroy() -rAthread rathread_self( ){ +rAthread *rathread_self() { #ifdef HAS_TLS - rAthread handle = &l_threads[g_rathread_ID]; + rAthread *handle = &l_threads[g_rathread_ID]; if(handle->proc != NULL) // entry point set, so its used! return handle; @@ -276,7 +276,7 @@ int rathread_get_tid(){ }//end: rathread_get_tid() -bool rathread_wait( rAthread handle, void* *out_exitCode ){ +bool rathread_wait(rAthread *handle, void **out_exitCode) { // Hint: // no thread data cleanup routine call here! @@ -294,13 +294,13 @@ bool rathread_wait( rAthread handle, void* *out_exitCode ){ }//end: rathread_wait() -void rathread_prio_set( rAthread handle, RATHREAD_PRIO prio ){ +void rathread_prio_set(rAthread *handle, RATHREAD_PRIO prio) { handle->prio = RAT_PRIO_NORMAL; //@TODO }//end: rathread_prio_set() -RATHREAD_PRIO rathread_prio_get( rAthread handle){ +RATHREAD_PRIO rathread_prio_get(rAthread *handle) { return handle->prio; }//end: rathread_prio_get() |