diff options
author | dgp <dgp@users.sourceforge.net> | 2012-06-22 19:04:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-06-22 19:04:31 (GMT) |
commit | bc7ed66ad757475d649f77ef0a52c71966b8c42a (patch) | |
tree | b1b62b645128d484d02bc30abd3897116360c3ac | |
parent | e276d32be530892ebd4fd2a0fb1fd99fee8c3b50 (diff) | |
parent | e87f03c29d1158714d9319724311d1091997611d (diff) | |
download | tcl-bc7ed66ad757475d649f77ef0a52c71966b8c42a.zip tcl-bc7ed66ad757475d649f77ef0a52c71966b8c42a.tar.gz tcl-bc7ed66ad757475d649f77ef0a52c71966b8c42a.tar.bz2 |
merge 8.5
-rw-r--r-- | generic/tclFileSystem.h | 1 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 49 |
2 files changed, 12 insertions, 38 deletions
diff --git a/generic/tclFileSystem.h b/generic/tclFileSystem.h index 778c9ac..828e81d 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 d397a16..9d81d18 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -399,7 +399,6 @@ Tcl_Filesystem tclNativeFilesystem = { static FilesystemRecord nativeFilesystemRecord = { NULL, &tclNativeFilesystem, - 1, NULL, NULL }; @@ -480,10 +479,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; @@ -599,11 +596,9 @@ FsRecacheFilesystemList(void) if (tsdPtr->claims <= 0) { 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; } } else { @@ -718,9 +713,7 @@ Disclaim() while (toRelease != NULL) { fsRecPtr = (toRelease == toRelease->prevPtr) ? NULL : toRelease->prevPtr; - if (--toRelease->fileRefCount <= 0) { - ckfree((char *)toRelease); - } + ckfree((char *)toRelease); toRelease = fsRecPtr; } } @@ -832,14 +825,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; } @@ -883,11 +873,6 @@ TclResetFilesystem(void) filesystemList = &nativeFilesystemRecord; theFilesystemEpoch++; - /* - * 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 @@ -945,13 +930,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 @@ -1024,7 +1002,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; @@ -1045,10 +1023,7 @@ Tcl_FSUnregister( theFilesystemEpoch++; - fsRecPtr->fileRefCount--; - if (fsRecPtr->fileRefCount <= 0) { - ckfree((char *)fsRecPtr); - } + ckfree((char *)fsRecPtr); retVal = TCL_OK; } else { |