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/tclPathObj.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/tclPathObj.c')
-rw-r--r-- | generic/tclPathObj.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 9ce22e5..b210a50 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPathObj.c,v 1.34 2004/09/27 15:00:40 vincentdarley Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.35 2004/09/29 22:17:30 dkf Exp $ */ #include "tclInt.h" @@ -1204,9 +1204,7 @@ TclFSMakePathRelative(interp, pathPtr, cwdPtr) } pathPtr->typePtr->updateStringProc(pathPtr); } - if ((pathPtr->typePtr->freeIntRepProc) != NULL) { - (*pathPtr->typePtr->freeIntRepProc)(pathPtr); - } + TclFreeIntRep(pathPtr); } fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath)); @@ -1308,9 +1306,7 @@ TclFSMakePathFromNormalized(interp, pathPtr, nativeRep) } pathPtr->typePtr->updateStringProc(pathPtr); } - if ((pathPtr->typePtr->freeIntRepProc) != NULL) { - (*pathPtr->typePtr->freeIntRepProc)(pathPtr); - } + TclFreeIntRep(pathPtr); } fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath)); @@ -1384,9 +1380,7 @@ Tcl_FSNewNativePath(fromFilesystem, clientData) } pathPtr->typePtr->updateStringProc(pathPtr); } - if ((pathPtr->typePtr->freeIntRepProc) != NULL) { - (*pathPtr->typePtr->freeIntRepProc)(pathPtr); - } + TclFreeIntRep(pathPtr); } fsPathPtr = (FsPath*)ckalloc((unsigned)sizeof(FsPath)); @@ -2252,9 +2246,7 @@ SetFsPathFromAny(interp, pathPtr) /* * Free old representation before installing our new one. */ - if (pathPtr->typePtr != NULL && pathPtr->typePtr->freeIntRepProc != NULL) { - (pathPtr->typePtr->freeIntRepProc)(pathPtr); - } + TclFreeIntRep(pathPtr); PATHOBJ(pathPtr) = (VOID *) fsPathPtr; PATHFLAGS(pathPtr) = 0; pathPtr->typePtr = &tclFsPathType; |