From d4d66c05ba64ebd9ae204c048eebebfd76a095c2 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 2 Jul 2015 12:54:57 +0000 Subject: Revert refcount changes that were not cosmetic. Changing equality testing to inequality testing does more than make code prettier or clearer. It makes it less strict, and thus more tolerant of other bugs elsewhere. Such changes deserve separate consideration at least, not breezy entry in an otherwise "code cleanup" commit. --- generic/tclCompile.c | 2 +- generic/tclNamesp.c | 2 +- generic/tclObj.c | 4 ++-- generic/tclPreserve.c | 4 ++-- generic/tclProc.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index b9aee64..361c26f 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -1117,7 +1117,7 @@ TclCleanupByteCode( } } - if (codePtr->localCachePtr && (codePtr->localCachePtr->refCount-- <= 1)) { + if (codePtr->localCachePtr && (--codePtr->localCachePtr->refCount == 0)) { TclFreeLocalCache(interp, codePtr->localCachePtr); } diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 3231ce6..91239f0 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -402,7 +402,7 @@ Tcl_PopCallFrame( } if (framePtr->numCompiledLocals > 0) { TclDeleteCompiledLocalVars(iPtr, framePtr); - if (framePtr->localCachePtr->refCount-- <= 1) { + if (--framePtr->localCachePtr->refCount == 0) { TclFreeLocalCache(interp, framePtr->localCachePtr); } framePtr->localCachePtr = NULL; diff --git a/generic/tclObj.c b/generic/tclObj.c index 15d874f..f9216b3 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -4288,7 +4288,7 @@ FreeCmdNameInternalRep( * there are no more uses, free the ResolvedCmdName structure. */ - if (resPtr->refCount-- <= 1) { + if (resPtr->refCount-- == 1) { /* * Now free the cached command, unless it is still in its hash * table or if there are other references to it from other cmdName @@ -4404,7 +4404,7 @@ SetCmdNameFromAny( Command *oldCmdPtr = resPtr->cmdPtr; - if (oldCmdPtr->refCount-- <= 1) { + if (--oldCmdPtr->refCount == 0) { TclCleanupCommandMacro(oldCmdPtr); } } else { diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c index 0b33d22..cca13e8 100644 --- a/generic/tclPreserve.c +++ b/generic/tclPreserve.c @@ -195,7 +195,7 @@ Tcl_Release( continue; } - if (refPtr->refCount-- > 1) { + if (--refPtr->refCount != 0) { Tcl_MutexUnlock(&preserveMutex); return; } @@ -459,7 +459,7 @@ TclHandleRelease( handlePtr, handlePtr->ptr2, handlePtr->ptr); } #endif - if ((handlePtr->refCount-- <= 1) && (handlePtr->ptr == NULL)) { + if ((--handlePtr->refCount == 0) && (handlePtr->ptr == NULL)) { ckfree(handlePtr); } } diff --git a/generic/tclProc.c b/generic/tclProc.c index a9705eb..7bf63c2 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -2445,7 +2445,7 @@ FreeLambdaInternalRep( Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1; Tcl_Obj *nsObjPtr = objPtr->internalRep.twoPtrValue.ptr2; - if (procPtr->refCount-- <= 1) { + if (procPtr->refCount-- == 1) { TclProcCleanupProc(procPtr); } TclDecrRefCount(nsObjPtr); -- cgit v0.12