Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove dead code that complicates fs path values but adds no value. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core-8-5-branch |
Files: | files | file ages | folders |
SHA1: |
1dbe30bfaff8f477e98538808f8e78b4 |
User & Date: | dgp 2012-06-20 19:19:53 |
Context
2012-06-20
| ||
20:02 | Remove dead code that complicates fs path values but adds no value. check-in: dd88cbe53a user: dgp tags: trunk | |
19:49 | Purge more dead fs path code. check-in: 2c1828bed8 user: dgp tags: core-8-5-branch | |
19:19 | Remove dead code that complicates fs path values but adds no value. check-in: 1dbe30bfaf user: dgp tags: core-8-5-branch | |
18:22 | ...and one more line. check-in: 2d65ec28fb user: dgp tags: core-8-4-branch | |
2012-06-19
| ||
14:57 | Plug memory leak, part of [Bug #3362446] check-in: 05b87bac69 user: jan.nijtmans tags: core-8-5-branch | |
Changes
Changes to generic/tclFileSystem.h.
︙ | ︙ | |||
59 60 61 62 63 64 65 | * paths efficiently, taking direct advantage of the "path" Tcl_Obj type. * * These functions are not exported at all at present. */ MODULE_SCOPE int TclFSCwdPointerEquals(Tcl_Obj **pathPtrPtr); MODULE_SCOPE int TclFSMakePathFromNormalized(Tcl_Interp *interp, | | | < | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | * paths efficiently, taking direct advantage of the "path" Tcl_Obj type. * * These functions are not exported at all at present. */ MODULE_SCOPE int TclFSCwdPointerEquals(Tcl_Obj **pathPtrPtr); MODULE_SCOPE int TclFSMakePathFromNormalized(Tcl_Interp *interp, Tcl_Obj *pathPtr); MODULE_SCOPE int TclFSNormalizeToUniquePath(Tcl_Interp *interp, Tcl_Obj *pathPtr, int startAt); MODULE_SCOPE Tcl_Obj * TclFSMakePathRelative(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_Obj *cwdPtr); MODULE_SCOPE Tcl_Obj * TclFSInternalToNormalized( Tcl_Filesystem *fromFilesystem, ClientData clientData, FilesystemRecord **fsRecPtrPtr); MODULE_SCOPE int TclFSEnsureEpochOk(Tcl_Obj *pathPtr, |
︙ | ︙ |
Changes to generic/tclIOUtil.c.
︙ | ︙ | |||
1405 1406 1407 1408 1409 1410 1411 | *--------------------------------------------------------------------------- */ int TclFSNormalizeToUniquePath( Tcl_Interp *interp, /* Used for error messages. */ Tcl_Obj *pathPtr, /* The path to normalize in place */ | | < < < < < | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | *--------------------------------------------------------------------------- */ int TclFSNormalizeToUniquePath( Tcl_Interp *interp, /* Used for error messages. */ Tcl_Obj *pathPtr, /* The path to normalize in place */ int startAt) /* Start at this char-offset */ { FilesystemRecord *fsRecPtr, *firstFsRecPtr; /* * Call each of the "normalise path" functions in succession. This is a * special case, in which if we have a native filesystem handler, we call * it first. This is because the root of Tcl's filesystem is always a * native filesystem (i.e. '/' on unix is native). */ |
︙ | ︙ |
Changes to generic/tclPathObj.c.
︙ | ︙ | |||
155 156 157 158 159 160 161 | Tcl_Obj *pathPtr, /* Absolute path to normalize */ ClientData *clientDataPtr) /* If non-NULL, then may be set to the * fs-specific clientData for this path. This * will happen when that extra information can * be calculated efficiently as a side-effect * of normalization. */ { | < | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | Tcl_Obj *pathPtr, /* Absolute path to normalize */ ClientData *clientDataPtr) /* If non-NULL, then may be set to the * fs-specific clientData for this path. This * will happen when that extra information can * be calculated efficiently as a side-effect * of normalization. */ { const char *dirSep, *oldDirSep; int first = 1; /* Set to zero once we've passed the first * directory separator - we can't use '..' to * remove the volume in a path. */ Tcl_Obj *retVal = NULL; dirSep = TclGetString(pathPtr); |
︙ | ︙ | |||
428 429 430 431 432 433 434 | * and also has the weird 'longname/shortname' thing (e.g. C:/Program * Files/ and C:/Progra~1/ are equivalent). * * Virtual file systems which may be registered may have other criteria * for normalizing a path. */ | | | | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | * and also has the weird 'longname/shortname' thing (e.g. C:/Program * Files/ and C:/Progra~1/ are equivalent). * * Virtual file systems which may be registered may have other criteria * for normalizing a path. */ TclFSNormalizeToUniquePath(interp, retVal, 0); /* * Since we know it is a normalized path, we can actually convert this * object into an FsPath for greater efficiency */ TclFSMakePathFromNormalized(interp, retVal); if (clientDataPtr != NULL) { *clientDataPtr = NULL; } /* * This has a refCount of 1 for the caller, unlike many Tcl_Obj APIs. */ return retVal; |
︙ | ︙ | |||
1554 1555 1556 1557 1558 1559 1560 | * *--------------------------------------------------------------------------- */ int TclFSMakePathFromNormalized( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ | | < < | 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | * *--------------------------------------------------------------------------- */ int TclFSMakePathFromNormalized( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *pathPtr) /* The object to convert. */ { FsPath *fsPathPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); if (pathPtr->typePtr == &tclFsPathType) { return TCL_OK; } |
︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | /* * Circular reference by design. */ fsPathPtr->normPathPtr = pathPtr; fsPathPtr->cwdPtr = NULL; | | | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | /* * Circular reference by design. */ fsPathPtr->normPathPtr = pathPtr; fsPathPtr->cwdPtr = NULL; fsPathPtr->nativePathPtr = NULL; fsPathPtr->fsRecPtr = NULL; fsPathPtr->filesystemEpoch = tsdPtr->filesystemEpoch; SETPATHOBJ(pathPtr, fsPathPtr); PATHFLAGS(pathPtr) = 0; pathPtr->typePtr = &tclFsPathType; |
︙ | ︙ | |||
1840 1841 1842 1843 1844 1845 1846 | /* * This is a special path object which is the result of something like * 'file join' */ Tcl_Obj *dir, *copy; int cwdLen, pathType; | < | 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 | /* * This is a special path object which is the result of something like * 'file join' */ Tcl_Obj *dir, *copy; int cwdLen, pathType; pathType = Tcl_FSGetPathType(fsPathPtr->cwdPtr); dir = Tcl_FSGetNormalizedPath(interp, fsPathPtr->cwdPtr); if (dir == NULL) { return NULL; } /* TODO: Figure out why this is needed. */ |
︙ | ︙ | |||
1888 1889 1890 1891 1892 1893 1894 | * portion. When this is sufficient, prior developers claim * this should be much faster. We use 'cwdLen-1' so that we are * already pointing at the dir-separator that we know about. * The normalization code will actually start off directly * after that separator. */ | | < | 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 | * portion. When this is sufficient, prior developers claim * this should be much faster. We use 'cwdLen-1' so that we are * already pointing at the dir-separator that we know about. * The normalization code will actually start off directly * after that separator. */ TclFSNormalizeToUniquePath(interp, copy, cwdLen-1); } /* Now we need to construct the new path object. */ if (pathType == TCL_PATH_RELATIVE) { Tcl_Obj *origDir = fsPathPtr->cwdPtr; |
︙ | ︙ | |||
1932 1933 1934 1935 1936 1937 1938 | /* * That's our reference to copy used. */ TclDecrRefCount(dir); } | < < < < < < < < < < | < < < < | 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 | /* * That's our reference to copy used. */ TclDecrRefCount(dir); } PATHFLAGS(pathPtr) = 0; } /* * Ensure cwd hasn't changed. */ if (fsPathPtr->cwdPtr != NULL) { if (!TclFSCwdPointerEquals(&fsPathPtr->cwdPtr)) { if (pathPtr->bytes == NULL) { UpdateStringOfFsPath(pathPtr); } FreeFsPathInternalRep(pathPtr); if (Tcl_ConvertToType(interp, pathPtr, &tclFsPathType) != TCL_OK) { return NULL; } fsPathPtr = PATHOBJ(pathPtr); } else if (fsPathPtr->normPathPtr == NULL) { int cwdLen; Tcl_Obj *copy; copy = AppendPath(fsPathPtr->cwdPtr, pathPtr); (void) Tcl_GetStringFromObj(fsPathPtr->cwdPtr, &cwdLen); cwdLen += (Tcl_GetString(copy)[cwdLen] == '/'); /* * Normalize the combined string, but only starting after the end * of the previously normalized 'dir'. This should be much faster! */ TclFSNormalizeToUniquePath(interp, copy, cwdLen-1); fsPathPtr->normPathPtr = copy; Tcl_IncrRefCount(fsPathPtr->normPathPtr); } } if (fsPathPtr->normPathPtr == NULL) { ClientData clientData = NULL; Tcl_Obj *useThisCwd = NULL; int pureNormalized = 1; |
︙ | ︙ |