From 84d9840ea49d4c8c3a29d12615b526c25878518d Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 7 Aug 2001 01:00:02 +0000 Subject: * generic/tclFileName.c (Tcl_FSSplitPath): update to Tcl style guide. * generic/tclFCmd.c (FileCopyRename): fixed mem leak in introduction of vfs code where a new Tcl_Obj wasn't freed. --- ChangeLog | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclFCmd.c | 42 ++++++++++++++++++--------------------- generic/tclFileName.c | 25 ++++++++++++----------- 3 files changed, 88 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8def608..a32bd88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2001-08-06 Jeff Hobbs + + * generic/tclFileName.c (Tcl_FSSplitPath): update to Tcl style + guide. + + * generic/tclFCmd.c (FileCopyRename): fixed mem leak in + introduction of vfs code where a new Tcl_Obj wasn't freed. + + * generic/tclCmdMZ.c (Tcl_RegexpObjCmd, Tcl_RegsubObjCmd): + reordered the retrieval of arguments to avoid shimmering bug when + the pattern and string referenced the same object. + + * unix/configure: regenerated + * unix/tcl.m4: added GNU (HURD) configuration target. (brinkmann) + [Patch: #442974] + + * win/README: made note of URL for Windows compilation notes + + * win/tclWinThrd.c (TclpFinalizeMutex, TclpFinalizeCondition): + added DeleteCriticalSection calls for cleanup [Patch: #419683] + + * unix/tclUnixPipe.c (TclpCreateTempFile): fixed use of tmpnam, + which is dangerous. [Patch: #442636] (lim) + The use of tmpnam in TclpTempFileName must still be changed. + + * tests/http.test (http-4.14): fixed variable error return. + [Bug: 424252] + +2001-08-03 Jeff Hobbs + + * win/configure: regenerated + * win/tcl.m4: fixed DLLSUFFIX definition to always be ${DBGX}.dll. + This is necessary for TEA compliant builds that build shared + against a static-built Tcl. + * win/Makefile.in ($(TCLSH)): added $(TCL_STUB_LIB_FILE) to build + target, otherwise it wouldn't get generated in a static build. + 2001-08-06 Andreas Kupries * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from SF item @@ -18,7 +55,13 @@ package arguments it receives, not stopping when a package is not found. [Bug 415273] +2001-08-02 Jeff Hobbs + + * generic/tclIOUtil.c (Tcl_FSMatchInDirectory): corrected + uninitialized value. + 2001-08-02 Mo DeJong + * generic/tclPlatDecls.h: * win/tclWinPort.h: Revert related changes made to improve @@ -26,6 +69,18 @@ up breaking the VC++ build because of conflicts between Windows APIs and internal Tk APIs. +2001-08-01 Jeff Hobbs + + * unix/tclUnixFCmd.c: minor casts to eliminate warnings. (lim) + [Patch: #440218] + + * tests/parseOld.test: changed some tests that required + testwordend to exist to skip in a proper tcltest manner. + [Bug: #442663] + + * library/http/http.tcl (http::mapReply): the regsub'ing of \n and + \t to escape them was unnecessary. + 2001-07-31 Vince Darley Changes from TIP#17 "Redo Tcl's filesystem" diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index c169427..e0eccf9 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFCmd.c,v 1.7 2001/07/31 19:12:06 vincentdarley Exp $ + * RCS: @(#) $Id: tclFCmd.c,v 1.8 2001/08/07 01:00:02 hobbs Exp $ */ #include "tclInt.h" @@ -188,11 +188,12 @@ FileCopyRename(interp, objc, objv, copyFlag) temp = Tcl_NewListObj(2, jargv); newFileName = Tcl_FSJoinPath(temp, -1); Tcl_IncrRefCount(newFileName); - Tcl_DecrRefCount(temp); - result = CopyRenameOneFile(interp, objv[i], newFileName, copyFlag, force); Tcl_DecrRefCount(newFileName); + Tcl_DecrRefCount(temp); + Tcl_DecrRefCount(source); + if (result == TCL_ERROR) { break; } @@ -756,20 +757,18 @@ FileBasename(interp, pathPtr) Tcl_Obj *pathPtr; /* Path whose basename to extract. */ { int objc; - Tcl_Obj *split; - Tcl_Obj *resPtr = NULL; + Tcl_Obj *splitPtr; + Tcl_Obj *resultPtr = NULL; - split = Tcl_FSSplitPath(pathPtr, &objc); + splitPtr = Tcl_FSSplitPath(pathPtr, &objc); if (objc != 0) { if ((objc == 1) && (*Tcl_GetString(pathPtr) == '~')) { - + Tcl_DecrRefCount(splitPtr); if (Tcl_FSConvertToPathType(interp, pathPtr) != TCL_OK) { - Tcl_DecrRefCount(split); return NULL; } - Tcl_DecrRefCount(split); - split = Tcl_FSSplitPath(pathPtr, &objc); + splitPtr = Tcl_FSSplitPath(pathPtr, &objc); } /* @@ -778,23 +777,20 @@ FileBasename(interp, pathPtr) */ if (objc > 0) { - if (objc > 1) { - Tcl_ListObjIndex(NULL, split, objc-1, &resPtr); - } else { - Tcl_Obj *temp; - Tcl_ListObjIndex(NULL, split, 0, &temp); - if (Tcl_GetPathType(Tcl_GetString(temp)) == TCL_PATH_RELATIVE) { - Tcl_ListObjIndex(NULL, split, objc-1, &resPtr); - } + Tcl_ListObjIndex(NULL, splitPtr, objc-1, &resultPtr); + if ((objc == 1) && + (Tcl_GetPathType(Tcl_GetString(resultPtr)) + != TCL_PATH_RELATIVE)) { + resultPtr = NULL; } } } - if (resPtr == NULL) { - resPtr = Tcl_NewStringObj("",0); + if (resultPtr == NULL) { + resultPtr = Tcl_NewObj(); } - Tcl_IncrRefCount(resPtr); - Tcl_DecrRefCount(split); - return resPtr; + Tcl_IncrRefCount(resultPtr); + Tcl_DecrRefCount(splitPtr); + return resultPtr; } /* diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 31332ac..0da7299 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.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: tclFileName.c,v 1.15 2001/07/31 19:12:06 vincentdarley Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.16 2001/08/07 01:00:02 hobbs Exp $ */ #include "tclInt.h" @@ -331,21 +331,24 @@ Tcl_GetPathType(path) */ Tcl_Obj* -Tcl_FSSplitPath(Tcl_Obj* pathPtr, int *lenPtr) { +Tcl_FSSplitPath(pathPtr, lenPtr) + Tcl_Obj *pathPtr; /* Path to split. */ + int *lenPtr; /* int to store number of path elements. */ +{ int argc, i; - char** argv; - Tcl_Obj* res; - - Tcl_SplitPath(Tcl_GetString(pathPtr),&argc,&argv); + char **argv; + Tcl_Obj *resultPtr = Tcl_NewObj(); + + Tcl_SplitPath(Tcl_GetString(pathPtr), &argc, &argv); if (lenPtr != NULL) { *lenPtr = argc; } - res = Tcl_NewListObj(0,NULL); - for (i=0;i