diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-14 08:26:06 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-14 08:26:06 (GMT) |
| commit | 37d4aa08d3f40d35c2672d95935f59454f849b84 (patch) | |
| tree | 678acacedb8ab68f7b04f677fbf2462d10599208 /generic/tclFileName.c | |
| parent | d3a24bbdf1e4e8f56b6c6c15e9886ed6320b890f (diff) | |
| download | tcl-37d4aa08d3f40d35c2672d95935f59454f849b84.zip tcl-37d4aa08d3f40d35c2672d95935f59454f849b84.tar.gz tcl-37d4aa08d3f40d35c2672d95935f59454f849b84.tar.bz2 | |
Backout the "dullest commit ever" (not my words ....). It breaks the build.
JN: Many of those changes are actually good, but there are too many changes to be able to search for a bug somewhere. Feel free to re-apply, after assuring it's really only whitespace changes. (my advise: do that after 9.0b2)
Diffstat (limited to 'generic/tclFileName.c')
| -rw-r--r-- | generic/tclFileName.c | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 9ef5b92..c99244c 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -348,7 +348,7 @@ Tcl_GetPathType( const char *path) { Tcl_PathType type; - Tcl_Obj *tempObj = Tcl_NewStringObj(path, -1); + Tcl_Obj *tempObj = Tcl_NewStringObj(path,-1); Tcl_IncrRefCount(tempObj); type = Tcl_FSGetPathType(tempObj); @@ -381,9 +381,8 @@ Tcl_GetPathType( Tcl_PathType TclpGetNativePathType( Tcl_Obj *pathPtr, /* Native path of interest */ - Tcl_Size *driveNameLengthPtr, - /* Returns length of drive, if non-NULL and - * path was absolute */ + Tcl_Size *driveNameLengthPtr, /* Returns length of drive, if non-NULL and + * path was absolute */ Tcl_Obj **driveNameRef) { Tcl_PathType type = TCL_PATH_ABSOLUTE; @@ -391,50 +390,50 @@ TclpGetNativePathType( switch (tclPlatform) { case TCL_PLATFORM_UNIX: { - const char *origPath = path; - - /* - * Paths that begin with / are absolute. - */ - - if (path[0] == '/') { - ++path; - /* - * Check for "//" network path prefix - */ - if ((*path == '/') && path[1] && (path[1] != '/')) { - path += 2; - while (*path && *path != '/') { - ++path; - } - } - if (driveNameLengthPtr != NULL) { - /* - * We need this addition in case the "//" code was used. - */ - - *driveNameLengthPtr = (path - origPath); - } - } else { - type = TCL_PATH_RELATIVE; - } - break; + const char *origPath = path; + + /* + * Paths that begin with / are absolute. + */ + + if (path[0] == '/') { + ++path; + /* + * Check for "//" network path prefix + */ + if ((*path == '/') && path[1] && (path[1] != '/')) { + path += 2; + while (*path && *path != '/') { + ++path; + } + } + if (driveNameLengthPtr != NULL) { + /* + * We need this addition in case the "//" code was used. + */ + + *driveNameLengthPtr = (path - origPath); + } + } else { + type = TCL_PATH_RELATIVE; + } + break; } case TCL_PLATFORM_WINDOWS: { - Tcl_DString ds; - const char *rootEnd; - - Tcl_DStringInit(&ds); - rootEnd = ExtractWinRoot(path, &ds, 0, &type); - if ((rootEnd != path) && (driveNameLengthPtr != NULL)) { - *driveNameLengthPtr = rootEnd - path; - if (driveNameRef != NULL) { - *driveNameRef = Tcl_DStringToObj(&ds); - Tcl_IncrRefCount(*driveNameRef); - } - } - Tcl_DStringFree(&ds); - break; + Tcl_DString ds; + const char *rootEnd; + + Tcl_DStringInit(&ds); + rootEnd = ExtractWinRoot(path, &ds, 0, &type); + if ((rootEnd != path) && (driveNameLengthPtr != NULL)) { + *driveNameLengthPtr = rootEnd - path; + if (driveNameRef != NULL) { + *driveNameRef = Tcl_DStringToObj(&ds); + Tcl_IncrRefCount(*driveNameRef); + } + } + Tcl_DStringFree(&ds); + break; } } return type; @@ -655,8 +654,9 @@ SplitUnixPath( } length = path - elementStart; if (length > 0) { - Tcl_Obj *nextElt = Tcl_NewStringObj(elementStart, length); - Tcl_ListObjAppendElement(NULL, result, nextElt); + Tcl_Obj *nextElt; + nextElt = Tcl_NewStringObj(elementStart, length); + Tcl_ListObjAppendElement(NULL, result, nextElt); } if (*path++ == '\0') { break; @@ -980,8 +980,8 @@ Tcl_JoinPath( * * Results: * The return value is a pointer to a string containing the name. - * This may either be the name pointer passed in or space allocated in - * bufferPtr. In all cases, if the return value is not NULL, the caller + * This may either be the name pointer passed in or space allocated in + * bufferPtr. In all cases, if the return value is not NULL, the caller * must call Tcl_DStringFree() to free the space. If there was an * error in processing the name, then an error message is left in the * interp's result (if interp was not NULL) and the return value is NULL. @@ -1132,7 +1132,7 @@ Tcl_GlobObjCmd( GLOB_DIR, GLOB_JOIN, GLOB_NOCOMPLAIN, GLOB_PATH, GLOB_TAILS, GLOB_TYPE, GLOB_LAST } index; - enum pathDirOptions {PATH_NONE = -1, PATH_GENERAL = 0, PATH_DIR = 1}; + enum pathDirOptions {PATH_NONE = -1 , PATH_GENERAL = 0, PATH_DIR = 1}; Tcl_GlobTypeData *globTypes = NULL; globFlags = 0; @@ -1193,7 +1193,7 @@ Tcl_GlobObjCmd( case GLOB_JOIN: /* -join */ join = 1; break; - case GLOB_TAILS: /* -tails */ + case GLOB_TAILS: /* -tails */ globFlags |= TCL_GLOBMODE_TAILS; break; case GLOB_PATH: /* -path */ @@ -1259,7 +1259,7 @@ Tcl_GlobObjCmd( if (dir == PATH_GENERAL) { Tcl_Size pathlength; const char *last; - const char *first = TclGetStringFromObj(pathOrDir, &pathlength); + const char *first = TclGetStringFromObj(pathOrDir,&pathlength); /* * Find the last path separator in the path @@ -2255,7 +2255,7 @@ DoGlob( */ Tcl_Size len; - const char *joined = TclGetStringFromObj(joinedPtr, &len); + const char *joined = TclGetStringFromObj(joinedPtr,&len); if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) { Tcl_AppendToObj(joinedPtr, "/", 1); @@ -2292,7 +2292,7 @@ DoGlob( */ Tcl_Size len; - const char *joined = TclGetStringFromObj(joinedPtr, &len); + const char *joined = TclGetStringFromObj(joinedPtr,&len); if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) { if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) { |
