diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-09-29 22:17:28 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-09-29 22:17:28 (GMT) |
commit | 1d5b0da0c8f65eeca48341adca32a96a8774f84a (patch) | |
tree | 9a574faca8ab395bddcb8ebbfcba24f070a7296a /generic/tclListObj.c | |
parent | e63ee140f8bf8b9c127ad90c03a516be076d6ae1 (diff) | |
download | tcl-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/tclListObj.c')
-rw-r--r-- | generic/tclListObj.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index c990045..ef88192 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclListObj.c,v 1.18 2003/12/24 04:18:20 davygrvy Exp $ + * RCS: @(#) $Id: tclListObj.c,v 1.19 2004/09/29 22:17:30 dkf Exp $ */ #include "tclInt.h" @@ -351,7 +351,6 @@ Tcl_SetListObj(objPtr, objc, objv) { register Tcl_Obj **elemPtrs; register List *listRepPtr; - Tcl_ObjType *oldTypePtr = objPtr->typePtr; int i; if (Tcl_IsShared(objPtr)) { @@ -362,9 +361,7 @@ Tcl_SetListObj(objPtr, objc, objv) * Free any old string rep and any internal rep for the old type. */ - if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) { - oldTypePtr->freeIntRepProc(objPtr); - } + TclFreeIntRep(objPtr); objPtr->typePtr = NULL; Tcl_InvalidateStringRep(objPtr); @@ -1559,7 +1556,6 @@ SetListFromAny(interp, objPtr) Tcl_Interp *interp; /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr; /* The object to convert. */ { - Tcl_ObjType *oldTypePtr = objPtr->typePtr; char *string, *s; CONST char *elemStart, *nextElem; int lenRemain, length, estCount, elemSize, hasBrace, i, j, result; @@ -1652,10 +1648,7 @@ SetListFromAny(interp, objPtr) * Tcl_GetStringFromObj, to use that old internalRep. */ - if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) { - oldTypePtr->freeIntRepProc(objPtr); - } - + TclFreeIntRep(objPtr); objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) listRepPtr; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclListType; |