summaryrefslogtreecommitdiffstats
path: root/generic/tclFileName.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-08-07 01:00:02 (GMT)
committerhobbs <hobbs>2001-08-07 01:00:02 (GMT)
commit84d9840ea49d4c8c3a29d12615b526c25878518d (patch)
tree0cea4199bb36de1d133cfff2f537226a7b1d748a /generic/tclFileName.c
parentf546af5ac7018d30c4776d9c66006e2e8e425de7 (diff)
downloadtcl-84d9840ea49d4c8c3a29d12615b526c25878518d.zip
tcl-84d9840ea49d4c8c3a29d12615b526c25878518d.tar.gz
tcl-84d9840ea49d4c8c3a29d12615b526c25878518d.tar.bz2
* 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.
Diffstat (limited to 'generic/tclFileName.c')
-rw-r--r--generic/tclFileName.c25
1 files changed, 14 insertions, 11 deletions
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<argc;i++) {
- Tcl_ListObjAppendElement(NULL, res, Tcl_NewStringObj(argv[i],-1));
+ for (i = 0; i < argc; i++) {
+ Tcl_ListObjAppendElement(NULL, resultPtr,
+ Tcl_NewStringObj(argv[i], -1));
}
- ckfree((char*)argv);
- return res;
+ ckfree((char *) argv);
+ return resultPtr;
}
/*