summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclFileName.c5
-rw-r--r--generic/tclFileSystem.h1
-rw-r--r--generic/tclIOUtil.c50
3 files changed, 18 insertions, 38 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index de91d81..a6bb932 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2213,11 +2213,6 @@ DoGlob(
&& (strchr(separators, lastChar) == NULL))
|| ((length == 0) && (count > 0)))) {
Tcl_DStringAppend(&append, "/", 1);
-#ifdef __CYGWIN__
- if ((length == 0) && (count > 1)) {
- Tcl_DStringAppend(&append, "/", 1);
- }
-#endif
}
break;
}
diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h
index 3dfc1de..c50c751 100644
--- a/generic/tclFileSystem.h
+++ b/generic/tclFileSystem.h
@@ -28,7 +28,6 @@ typedef struct FilesystemRecord {
ClientData clientData; /* Client specific data for the new filesystem
* (can be NULL) */
Tcl_Filesystem *fsPtr; /* Pointer to filesystem dispatch table. */
- int fileRefCount; /* How many Tcl_Obj's use this filesystem. */
struct FilesystemRecord *nextPtr;
/* The next filesystem registered to Tcl, or
* NULL if no more. */
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 3bdcca3..9e36d64 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -398,7 +398,6 @@ Tcl_Filesystem tclNativeFilesystem = {
static FilesystemRecord nativeFilesystemRecord = {
NULL,
&tclNativeFilesystem,
- 1,
NULL,
NULL
};
@@ -479,9 +478,8 @@ FsThrExitProc(
fsRecPtr = tsdPtr->filesystemList;
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
- if (--fsRecPtr->fileRefCount <= 0) {
- ckfree((char *)fsRecPtr);
- }
+ fsRecPtr->fsPtr = NULL;
+ ckfree((char *)fsRecPtr);
fsRecPtr = tmpFsRecPtr;
}
tsdPtr->initialized = 0;
@@ -588,7 +586,7 @@ static void
FsRecacheFilesystemList(void)
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey);
- FilesystemRecord *fsRecPtr, *tmpFsRecPtr = NULL;
+ FilesystemRecord *fsRecPtr, *tmpFsRecPtr = NULL, *toFree = NULL;
/*
* Trash the current cache.
@@ -597,9 +595,9 @@ FsRecacheFilesystemList(void)
fsRecPtr = tsdPtr->filesystemList;
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
- if (--fsRecPtr->fileRefCount <= 0) {
- ckfree((char *)fsRecPtr);
- }
+ fsRecPtr->fsPtr = NULL;
+ fsRecPtr->nextPtr = toFree;
+ toFree = fsRecPtr;
fsRecPtr = tmpFsRecPtr;
}
tsdPtr->filesystemList = NULL;
@@ -634,6 +632,12 @@ FsRecacheFilesystemList(void)
fsRecPtr = fsRecPtr->prevPtr;
}
+ while (toFree) {
+ FilesystemRecord *next = toFree->nextPtr;
+ ckfree((char *)toFree);
+ toFree = next;
+ }
+
/*
* Make sure the above gets released on thread exit.
*/
@@ -787,14 +791,11 @@ TclFinalizeFilesystem(void)
fsRecPtr = filesystemList;
while (fsRecPtr != NULL) {
FilesystemRecord *tmpFsRecPtr = fsRecPtr->nextPtr;
- if (fsRecPtr->fileRefCount <= 0) {
- /*
- * The native filesystem is static, so we don't free it.
- */
- if (fsRecPtr->fsPtr != &tclNativeFilesystem) {
- ckfree((char *)fsRecPtr);
- }
+ /* The native filesystem is static, so we don't free it. */
+
+ if (fsRecPtr != &nativeFilesystemRecord) {
+ ckfree((char *)fsRecPtr);
}
fsRecPtr = tmpFsRecPtr;
}
@@ -836,11 +837,6 @@ TclResetFilesystem(void)
{
filesystemList = &nativeFilesystemRecord;
- /*
- * Note, at this point, I believe nativeFilesystemRecord -> fileRefCount
- * should equal 1 and if not, we should try to track down the cause.
- */
-
#ifdef __WIN32__
/*
* Cleans up the win32 API filesystem proc lookup table. This must happen
@@ -898,13 +894,6 @@ Tcl_FSRegister(
newFilesystemPtr->fsPtr = fsPtr;
/*
- * We start with a refCount of 1. If this drops to zero, then anyone is
- * welcome to ckfree us.
- */
-
- newFilesystemPtr->fileRefCount = 1;
-
- /*
* Is this lock and wait strictly speaking necessary? Since any iterators
* out there will have grabbed a copy of the head of the list and be
* iterating away from that, if we add a new element to the head of the
@@ -977,7 +966,7 @@ Tcl_FSUnregister(
*/
fsRecPtr = filesystemList;
- while ((retVal == TCL_ERROR) && (fsRecPtr->fsPtr != &tclNativeFilesystem)) {
+ while ((retVal == TCL_ERROR) && (fsRecPtr != &nativeFilesystemRecord)) {
if (fsRecPtr->fsPtr == fsPtr) {
if (fsRecPtr->prevPtr) {
fsRecPtr->prevPtr->nextPtr = fsRecPtr->nextPtr;
@@ -998,10 +987,7 @@ Tcl_FSUnregister(
theFilesystemEpoch++;
- fsRecPtr->fileRefCount--;
- if (fsRecPtr->fileRefCount <= 0) {
- ckfree((char *)fsRecPtr);
- }
+ ckfree((char *)fsRecPtr);
retVal = TCL_OK;
} else {