summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-09-29 22:17:28 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-09-29 22:17:28 (GMT)
commit1d5b0da0c8f65eeca48341adca32a96a8774f84a (patch)
tree9a574faca8ab395bddcb8ebbfcba24f070a7296a /generic/tclNamesp.c
parente63ee140f8bf8b9c127ad90c03a516be076d6ae1 (diff)
downloadtcl-1d5b0da0c8f65eeca48341adca32a96a8774f84a.zip
tcl-1d5b0da0c8f65eeca48341adca32a96a8774f84a.tar.gz
tcl-1d5b0da0c8f65eeca48341adca32a96a8774f84a.tar.bz2
Factorize out the code for freeing an object's internal rep.
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index abd179c..9238001 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -21,7 +21,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.55 2004/09/24 01:14:43 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.56 2004/09/29 22:17:30 dkf Exp $
*/
#include "tclInt.h"
@@ -4051,7 +4051,6 @@ SetNsNameFromAny(interp, objPtr)
* reporting if not NULL. */
register Tcl_Obj *objPtr; /* The object to convert. */
{
- register Tcl_ObjType *oldTypePtr = objPtr->typePtr;
char *name;
CONST char *dummy;
Namespace *nsPtr, *dummy1Ptr, *dummy2Ptr;
@@ -4101,10 +4100,7 @@ SetNsNameFromAny(interp, objPtr)
* (in particular, Tcl_GetStringFromObj) to use that old internalRep.
*/
- if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) {
- oldTypePtr->freeIntRepProc(objPtr);
- }
-
+ TclFreeIntRep(objPtr);
objPtr->internalRep.otherValuePtr = (VOID *) resNamePtr;
objPtr->typePtr = &tclNsNameType;
return TCL_OK;
@@ -5149,10 +5145,7 @@ MakeCachedEnsembleCommand(objPtr, ensemblePtr, subcommandName, prefixObjPtr)
* Kill the old internal rep, and replace it with a brand new
* one of our own.
*/
- if ((objPtr->typePtr != NULL)
- && (objPtr->typePtr->freeIntRepProc != NULL)) {
- objPtr->typePtr->freeIntRepProc(objPtr);
- }
+ TclFreeIntRep(objPtr);
ensembleCmd = (EnsembleCmdRep *) ckalloc(sizeof(EnsembleCmdRep));
objPtr->internalRep.otherValuePtr = (VOID *) ensembleCmd;
objPtr->typePtr = &tclEnsembleCmdType;