diff options
author | dkf <dkf@noemail.net> | 2011-03-12 15:06:47 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2011-03-12 15:06:47 (GMT) |
commit | dd3a8a349837409f90ccabcc9aef092197d4da6f (patch) | |
tree | ed891ab3e00ea5888426f25d675aff2d89a00b1d /generic/tclEnsemble.c | |
parent | 3bc57329cfbbd1026bf237979f491e7336f26c15 (diff) | |
download | tcl-dd3a8a349837409f90ccabcc9aef092197d4da6f.zip tcl-dd3a8a349837409f90ccabcc9aef092197d4da6f.tar.gz tcl-dd3a8a349837409f90ccabcc9aef092197d4da6f.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.
FossilOrigin-Name: 5574bdd262b2672cde48771787370c12854cecf4
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r-- | generic/tclEnsemble.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index bbc1e55..1c7b41d 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -616,8 +616,7 @@ Tcl_CreateEnsemble( int flags) { Namespace *nsPtr = (Namespace *) namespacePtr; - EnsembleConfig *ensemblePtr = (EnsembleConfig *) - ckalloc(sizeof(EnsembleConfig)); + EnsembleConfig *ensemblePtr = ckalloc(sizeof(EnsembleConfig)); Tcl_Obj *nameObj = NULL; if (nsPtr == NULL) { @@ -2189,7 +2188,7 @@ MakeCachedEnsembleCommand( */ TclFreeIntRep(objPtr); - ensembleCmd = (EnsembleCmdRep *) ckalloc(sizeof(EnsembleCmdRep)); + ensembleCmd = ckalloc(sizeof(EnsembleCmdRep)); objPtr->internalRep.otherValuePtr = ensembleCmd; objPtr->typePtr = &tclEnsembleCmdType; } @@ -2204,7 +2203,7 @@ MakeCachedEnsembleCommand( ensemblePtr->nsPtr->refCount++; ensembleCmd->realPrefixObj = prefixObjPtr; length = strlen(subcommandName)+1; - ensembleCmd->fullSubcmdName = ckalloc((unsigned) length); + ensembleCmd->fullSubcmdName = ckalloc(length); memcpy(ensembleCmd->fullSubcmdName, subcommandName, (unsigned) length); Tcl_IncrRefCount(ensembleCmd->realPrefixObj); } @@ -2271,7 +2270,7 @@ DeleteEnsembleConfig( */ if (ensemblePtr->subcommandTable.numEntries != 0) { - ckfree((char *) ensemblePtr->subcommandArrayPtr); + ckfree(ensemblePtr->subcommandArrayPtr); } hEnt = Tcl_FirstHashEntry(&ensemblePtr->subcommandTable, &search); while (hEnt != NULL) { @@ -2342,7 +2341,7 @@ BuildEnsembleConfig( * Remove pre-existing table. */ - ckfree((char *) ensemblePtr->subcommandArrayPtr); + ckfree(ensemblePtr->subcommandArrayPtr); hPtr = Tcl_FirstHashEntry(hash, &search); while (hPtr != NULL) { Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr); @@ -2497,7 +2496,7 @@ BuildEnsembleConfig( * the hash too, and vice versa) and running quicksort over the array. */ - ensemblePtr->subcommandArrayPtr = (char **) + ensemblePtr->subcommandArrayPtr = ckalloc(sizeof(char *) * hash->numEntries); /* @@ -2590,7 +2589,7 @@ FreeEnsembleCmdRep( Tcl_DecrRefCount(ensembleCmd->realPrefixObj); ckfree(ensembleCmd->fullSubcmdName); TclNsDecrRefCount(ensembleCmd->nsPtr); - ckfree((char *) ensembleCmd); + ckfree(ensembleCmd); objPtr->typePtr = NULL; } @@ -2618,8 +2617,7 @@ DupEnsembleCmdRep( Tcl_Obj *copyPtr) { EnsembleCmdRep *ensembleCmd = objPtr->internalRep.otherValuePtr; - EnsembleCmdRep *ensembleCopy = (EnsembleCmdRep *) - ckalloc(sizeof(EnsembleCmdRep)); + EnsembleCmdRep *ensembleCopy = ckalloc(sizeof(EnsembleCmdRep)); int length = strlen(ensembleCmd->fullSubcmdName); copyPtr->typePtr = &tclEnsembleCmdType; @@ -2630,7 +2628,7 @@ DupEnsembleCmdRep( ensembleCopy->nsPtr->refCount++; ensembleCopy->realPrefixObj = ensembleCmd->realPrefixObj; Tcl_IncrRefCount(ensembleCopy->realPrefixObj); - ensembleCopy->fullSubcmdName = ckalloc((unsigned) length+1); + ensembleCopy->fullSubcmdName = ckalloc(length + 1); memcpy(ensembleCopy->fullSubcmdName, ensembleCmd->fullSubcmdName, (unsigned) length+1); } @@ -2660,7 +2658,7 @@ StringOfEnsembleCmdRep( int length = strlen(ensembleCmd->fullSubcmdName); objPtr->length = length; - objPtr->bytes = ckalloc((unsigned) length+1); + objPtr->bytes = ckalloc(length + 1); memcpy(objPtr->bytes, ensembleCmd->fullSubcmdName, (unsigned) length+1); } |