diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2011-03-12 15:06:47 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2011-03-12 15:06:47 (GMT) |
| commit | da07e275b37faecb755a5d1cd6e55bf5dced5b6e (patch) | |
| tree | ed891ab3e00ea5888426f25d675aff2d89a00b1d /unix/tclUnixThrd.c | |
| parent | cc586c9ab635695477a2735f73aa166f4ecb4a5e (diff) | |
| download | tcl-da07e275b37faecb755a5d1cd6e55bf5dced5b6e.zip tcl-da07e275b37faecb755a5d1cd6e55bf5dced5b6e.tar.gz tcl-da07e275b37faecb755a5d1cd6e55bf5dced5b6e.tar.bz2 | |
Adjust ckalloc/ckfree macros to greatly reduce number of explicit casts in
rest of Tcl source code. No ABI change. API change *should* be harmless.
Diffstat (limited to 'unix/tclUnixThrd.c')
| -rw-r--r-- | unix/tclUnixThrd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 7a4300e..0469d7a 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -430,7 +430,7 @@ Tcl_MutexLock( * Double inside master lock check to avoid a race condition. */ - pmutexPtr = (pthread_mutex_t *) ckalloc(sizeof(pthread_mutex_t)); + pmutexPtr = ckalloc(sizeof(pthread_mutex_t)); pthread_mutex_init(pmutexPtr, NULL); *mutexPtr = (Tcl_Mutex)pmutexPtr; TclRememberMutex(mutexPtr); @@ -494,7 +494,7 @@ TclpFinalizeMutex( if (pmutexPtr != NULL) { pthread_mutex_destroy(pmutexPtr); - ckfree((char *) pmutexPtr); + ckfree(pmutexPtr); *mutexPtr = NULL; } } @@ -540,9 +540,9 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - pcondPtr = (pthread_cond_t *) ckalloc(sizeof(pthread_cond_t)); + pcondPtr = ckalloc(sizeof(pthread_cond_t)); pthread_cond_init(pcondPtr, NULL); - *condPtr = (Tcl_Condition)pcondPtr; + *condPtr = (Tcl_Condition) pcondPtr; TclRememberCondition(condPtr); } MASTER_UNLOCK; @@ -624,9 +624,10 @@ TclpFinalizeCondition( Tcl_Condition *condPtr) { pthread_cond_t *pcondPtr = *(pthread_cond_t **)condPtr; + if (pcondPtr != NULL) { pthread_cond_destroy(pcondPtr); - ckfree((char *) pcondPtr); + ckfree(pcondPtr); *condPtr = NULL; } } |
