summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-06-30 21:41:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-06-30 21:41:18 (GMT)
commit27ce2290a6e107aa7e2b8a5995fa32e32106546c (patch)
treed4a008c1cca0c1d8fb3f5fc7c741217ebb7534be /generic
parentc2ea0fbc1bd362371328c20f5408e45ec4f7770c (diff)
downloadtcl-27ce2290a6e107aa7e2b8a5995fa32e32106546c.zip
tcl-27ce2290a6e107aa7e2b8a5995fa32e32106546c.tar.gz
tcl-27ce2290a6e107aa7e2b8a5995fa32e32106546c.tar.bz2
Consistancy in refcount management.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompile.c4
-rw-r--r--generic/tclExecute.c2
-rw-r--r--generic/tclObj.c6
-rw-r--r--generic/tclProc.c6
-rw-r--r--generic/tclVar.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index a552f39..98756ea 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -978,7 +978,7 @@ FreeByteCodeInternalRep(
register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
- if (codePtr->refCount-- < 2) {
+ if (codePtr->refCount-- <= 1) {
TclCleanupByteCode(codePtr);
}
}
@@ -1364,7 +1364,7 @@ FreeSubstCodeInternalRep(
register ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
- if (codePtr->refCount-- < 2) {
+ if (codePtr->refCount-- <= 1) {
TclCleanupByteCode(codePtr);
}
}
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 5b053a6..6fc6b6b 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1649,7 +1649,7 @@ FreeExprCodeInternalRep(
ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr1;
objPtr->typePtr = NULL;
- if (codePtr->refCount-- < 2) {
+ if (codePtr->refCount-- <= 1) {
TclCleanupByteCode(codePtr);
}
}
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 80a3e31..15d874f 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -3803,7 +3803,7 @@ Tcl_DbDecrRefCount(
# endif /* TCL_THREADS */
#endif /* TCL_MEM_DEBUG */
- if (--(objPtr)->refCount <= 0) {
+ if (objPtr->refCount-- <= 1) {
TclFreeObj(objPtr);
}
}
@@ -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 == 0) {
+ if (oldCmdPtr->refCount-- <= 1) {
TclCleanupCommandMacro(oldCmdPtr);
}
} else {
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 6ffbd90..2679bf1 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -1842,7 +1842,7 @@ InterpProcNR2(
TCL_DTRACE_PROC_RETURN(l < iPtr->varFramePtr->objc ?
TclGetString(iPtr->varFramePtr->objv[l]) : NULL, result);
}
- if (--procPtr->refCount <= 0) {
+ if (procPtr->refCount-- <= 1) {
TclProcCleanupProc(procPtr);
}
@@ -2403,7 +2403,7 @@ ProcBodyFree(
{
Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1;
- if (procPtr->refCount-- < 2) {
+ if (procPtr->refCount-- <= 1) {
TclProcCleanupProc(procPtr);
}
}
@@ -2446,7 +2446,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);
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 8fb89cd..97aa7ab 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -5713,8 +5713,8 @@ FreeNsVarName(
{
register Var *varPtr = objPtr->internalRep.twoPtrValue.ptr2;
- if (TclIsVarInHash(varPtr)) {
- if ((varPtr->refCount-- == 1) && TclIsVarUndefined(varPtr)) {
+ if (TclIsVarInHash(varPtr) && TclIsVarUndefined(varPtr)) {
+ if ((varPtr->refCount-- <= 1)) {
CleanupVar(varPtr, NULL);
}
}