summaryrefslogtreecommitdiffstats
path: root/generic/tclPathObj.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-11-22 12:45:04 (GMT)
committersebres <sebres@users.sourceforge.net>2018-11-22 12:45:04 (GMT)
commita89cd349f181ad5d291f096086ef4ad632956bc7 (patch)
tree43463f9e7774e0edba02b18b76bb8a1a6efa8440 /generic/tclPathObj.c
parente02fb5a67bc4951e4e36007d4ddaaad531846b2b (diff)
downloadtcl-a89cd349f181ad5d291f096086ef4ad632956bc7.zip
tcl-a89cd349f181ad5d291f096086ef4ad632956bc7.tar.gz
tcl-a89cd349f181ad5d291f096086ef4ad632956bc7.tar.bz2
prepare merge: TclJoinPath is in internal API (MODULE_SCOPE) since 8.6 and static (used locally in tclPathObj) in 8.5
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r--generic/tclPathObj.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index c0e8081..d8be51a 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -29,6 +29,9 @@ static int IsSeparatorOrNull(int ch);
static Tcl_Obj * GetExtension(Tcl_Obj *pathPtr);
static int MakePathFromNormalized(Tcl_Interp *interp,
Tcl_Obj *pathPtr);
+static Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[],
+ int forceRelative);
+
/*
* Define the 'path' object type, which Tcl uses to represent file paths
@@ -821,8 +824,6 @@ GetExtension(
*---------------------------------------------------------------------------
*/
-Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[], int normalize);
-
Tcl_Obj *
Tcl_FSJoinPath(
Tcl_Obj *listObj, /* Path elements to join, may have a zero
@@ -843,12 +844,12 @@ Tcl_FSJoinPath(
return res;
}
-Tcl_Obj *
+static Tcl_Obj *
TclJoinPath(
int elements, /* Number of elements to use (-1 = all) */
Tcl_Obj * const objv[], /* Path elements to join */
- int normalize) /* 1 if special normalization case (force second
- * path relative) */
+ int forceRelative) /* If non-zero, assume all more paths are
+ * relative (e. g. simple normalization) */
{
Tcl_Obj *res = NULL; /* Resulting path object (container of join) */
Tcl_Obj *elt; /* Path part (result if returns part of path) */
@@ -880,8 +881,8 @@ TclJoinPath(
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[i+1];
-
- type = normalize ? TCL_PATH_RELATIVE :
+ /* if forceRelative - second path is relative */
+ type = forceRelative ? TCL_PATH_RELATIVE :
TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
const char *str;
@@ -954,7 +955,8 @@ TclJoinPath(
}
strElt = Tcl_GetStringFromObj(elt, &strEltLen);
driveNameLength = 0;
- type = (normalize && (i > 0)) ? TCL_PATH_RELATIVE :
+ /* if forceRelative - all paths excepting first one are relative */
+ type = (forceRelative && (i > 0)) ? TCL_PATH_RELATIVE :
TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName);
if (type != TCL_PATH_RELATIVE) {
/*