summaryrefslogtreecommitdiffstats
path: root/generic/tclVar.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/tclVar.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/tclVar.c')
-rw-r--r--generic/tclVar.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c
index a0a6f42..ed6ec8d 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -15,7 +15,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.91 2004/08/31 16:25:50 dgp Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.92 2004/09/29 22:17:28 dkf Exp $
*/
#ifdef STDC_HEADERS
@@ -498,9 +498,7 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2,
*/
objPtr = part1Ptr;
- if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- typePtr->freeIntRepProc(objPtr);
- }
+ TclFreeIntRep(objPtr);
objPtr->typePtr = &tclParsedVarNameType;
/*
@@ -529,10 +527,8 @@ TclObjLookupVar(interp, part1Ptr, part2, flags, msg, createPart1, createPart2,
* it to one of the cached types if possible.
*/
- if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- typePtr->freeIntRepProc(part1Ptr);
- part1Ptr->typePtr = NULL;
- }
+ TclFreeIntRep(part1Ptr);
+ part1Ptr->typePtr = NULL;
varPtr = TclLookupSimpleVar(interp, part1, flags,
createPart1, &errMsg, &index);
@@ -2299,7 +2295,7 @@ TclObjUnsetVar2(interp, part1Ptr, part2, flags)
*/
if (part1Ptr->typePtr == &tclNsVarNameType) {
- part1Ptr->typePtr->freeIntRepProc(part1Ptr);
+ TclFreeIntRep(part1Ptr);
part1Ptr->typePtr = NULL;
}
#endif
@@ -4019,9 +4015,7 @@ SetArraySearchObj(interp, objPtr)
end++;
offset = end - string;
- if (objPtr->typePtr != NULL && objPtr->typePtr->freeIntRepProc != NULL) {
- objPtr->typePtr->freeIntRepProc(objPtr);
- }
+ TclFreeIntRep(objPtr);
objPtr->typePtr = &tclArraySearchType;
objPtr->internalRep.twoPtrValue.ptr1 = (VOID *)(((char *)NULL)+id);
objPtr->internalRep.twoPtrValue.ptr2 = (VOID *)(((char *)NULL)+offset);