summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclFileSystem.h1
-rw-r--r--generic/tclIOUtil.c45
2 files changed, 11 insertions, 35 deletions
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 9a4af9a..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,10 +478,8 @@ FsThrExitProc(
fsRecPtr = tsdPtr->filesystemList;
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
- if (--fsRecPtr->fileRefCount <= 0) {
- fsRecPtr->fsPtr = NULL;
- ckfree((char *)fsRecPtr);
- }
+ fsRecPtr->fsPtr = NULL;
+ ckfree((char *)fsRecPtr);
fsRecPtr = tmpFsRecPtr;
}
tsdPtr->initialized = 0;
@@ -598,11 +595,9 @@ FsRecacheFilesystemList(void)
fsRecPtr = tsdPtr->filesystemList;
while (fsRecPtr != NULL) {
tmpFsRecPtr = fsRecPtr->nextPtr;
- if (--fsRecPtr->fileRefCount <= 0) {
- fsRecPtr->fsPtr = NULL;
- fsRecPtr->nextPtr = toFree;
- toFree = fsRecPtr;
- }
+ fsRecPtr->fsPtr = NULL;
+ fsRecPtr->nextPtr = toFree;
+ toFree = fsRecPtr;
fsRecPtr = tmpFsRecPtr;
}
tsdPtr->filesystemList = NULL;
@@ -796,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;
}
@@ -845,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
@@ -907,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
@@ -986,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;
@@ -1007,10 +987,7 @@ Tcl_FSUnregister(
theFilesystemEpoch++;
- fsRecPtr->fileRefCount--;
- if (fsRecPtr->fileRefCount <= 0) {
- ckfree((char *)fsRecPtr);
- }
+ ckfree((char *)fsRecPtr);
retVal = TCL_OK;
} else {