summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclBasic.c6
-rw-r--r--generic/tclCompile.c2
-rw-r--r--generic/tclDisassemble.c4
-rw-r--r--generic/tclIOGT.c4
-rw-r--r--generic/tclNamesp.c10
-rw-r--r--generic/tclObj.c6
-rw-r--r--generic/tclPreserve.c8
-rw-r--r--generic/tclTrace.c2
8 files changed, 19 insertions, 23 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 39f2dd4..8eebab1 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -3400,8 +3400,7 @@ TclCleanupCommand(
register Command *cmdPtr) /* Points to the Command structure to
* be freed. */
{
- cmdPtr->refCount--;
- if (cmdPtr->refCount <= 0) {
+ if (cmdPtr->refCount-- <= 1) {
ckfree(cmdPtr);
}
}
@@ -5578,8 +5577,7 @@ TclArgumentRelease(
}
cfwPtr = Tcl_GetHashValue(hPtr);
- cfwPtr->refCount--;
- if (cfwPtr->refCount > 0) {
+ if (cfwPtr->refCount-- > 1) {
continue;
}
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index c02a940..c0724ee 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1002,7 +1002,7 @@ void
TclReleaseByteCode(
register ByteCode *codePtr)
{
- if (--codePtr->refCount) {
+ if (codePtr->refCount-- > 1) {
return;
}
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c
index 0d6da8e..88ff094 100644
--- a/generic/tclDisassemble.c
+++ b/generic/tclDisassemble.c
@@ -272,8 +272,8 @@ DisassembleByteCodeObj(
sprintf(ptrBuf1, "%p", codePtr);
sprintf(ptrBuf2, "%p", iPtr);
Tcl_AppendPrintfToObj(bufferObj,
- "ByteCode 0x%s, refCt %u, epoch %u, interp 0x%s (epoch %u)\n",
- ptrBuf1, codePtr->refCount, codePtr->compileEpoch, ptrBuf2,
+ "ByteCode 0x%s, refCt %" TCL_LL_MODIFIER "u, epoch %u, interp 0x%s (epoch %u)\n",
+ ptrBuf1, (Tcl_WideInt)codePtr->refCount, codePtr->compileEpoch, ptrBuf2,
iPtr->compileEpoch);
Tcl_AppendToObj(bufferObj, " Source ", -1);
PrintSourceToObj(bufferObj, codePtr->source,
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c
index 7f61def..c1e8c44 100644
--- a/generic/tclIOGT.c
+++ b/generic/tclIOGT.c
@@ -211,7 +211,7 @@ struct TransformChannelData {
* a transformation of incoming data. Also
* serves as buffer of all data not yet
* consumed by the reader. */
- int refCount;
+ size_t refCount;
};
static void
@@ -225,7 +225,7 @@ static void
ReleaseData(
TransformChannelData *dataPtr)
{
- if (--dataPtr->refCount) {
+ if (dataPtr->refCount-- > 1) {
return;
}
ResultClear(&dataPtr->result);
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 7f6ecf5..1e360d1 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -32,7 +32,7 @@
*/
typedef struct ThreadSpecificData {
- long numNsCreated; /* Count of the number of namespaces created
+ size_t numNsCreated; /* Count of the number of namespaces created
* within the thread. This value is used as a
* unique id for each namespace. Cannot be
* per-interp because the nsId is used to
@@ -59,7 +59,7 @@ typedef struct ResolvedNsName {
* the name was resolved. NULL if the name is
* fully qualified and thus the resolution
* does not depend on the context. */
- int refCount; /* Reference count: 1 for each nsName object
+ size_t refCount; /* Reference count: 1 for each nsName object
* that has a pointer to this ResolvedNsName
* structure as its internal rep. This
* structure can be freed when refCount
@@ -1326,8 +1326,7 @@ void
TclNsDecrRefCount(
Namespace *nsPtr)
{
- nsPtr->refCount--;
- if ((nsPtr->refCount == 0) && (nsPtr->flags & NS_DEAD)) {
+ if ((nsPtr->refCount-- <= 1) && (nsPtr->flags & NS_DEAD)) {
NamespaceFree(nsPtr);
}
}
@@ -4671,8 +4670,7 @@ FreeNsNameInternalRep(
* references, free it up.
*/
- resNamePtr->refCount--;
- if (resNamePtr->refCount == 0) {
+ if (resNamePtr->refCount-- <= 1) {
/*
* Decrement the reference count for the cached namespace. If the
* namespace is dead, and there are no more references to it, free
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 6c850af..416e5ed 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -361,7 +361,7 @@ typedef struct ResolvedCmdName {
* incremented; if so, the cmd was renamed,
* deleted, hidden, or exposed, and so the
* pointer is invalid. */
- int refCount; /* Reference count: 1 for each cmdName object
+ size_t refCount; /* Reference count: 1 for each cmdName object
* that has a pointer to this ResolvedCmdName
* structure as its internal rep. This
* structure can be freed when refCount
@@ -4307,7 +4307,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
@@ -4419,7 +4419,7 @@ SetCmdNameFromAny(
Command *oldCmdPtr = resPtr->cmdPtr;
- if (--oldCmdPtr->refCount == 0) {
+ if (oldCmdPtr->refCount-- <= 1) {
TclCleanupCommandMacro(oldCmdPtr);
}
} else {
diff --git a/generic/tclPreserve.c b/generic/tclPreserve.c
index cca13e8..2d0e15c 100644
--- a/generic/tclPreserve.c
+++ b/generic/tclPreserve.c
@@ -22,7 +22,7 @@
typedef struct {
ClientData clientData; /* Address of preserved block. */
- int refCount; /* Number of Tcl_Preserve calls in effect for
+ size_t refCount; /* Number of Tcl_Preserve calls in effect for
* block. */
int mustFree; /* Non-zero means Tcl_EventuallyFree was
* called while a Tcl_Preserve call was in
@@ -63,7 +63,7 @@ typedef struct HandleStruct {
* ensure that the contents of the handle are
* not changed by anyone else. */
#endif
- int refCount; /* Number of TclHandlePreserve() calls in
+ size_t refCount; /* Number of TclHandlePreserve() calls in
* effect on this handle. */
} HandleStruct;
@@ -195,7 +195,7 @@ Tcl_Release(
continue;
}
- if (--refPtr->refCount != 0) {
+ if (refPtr->refCount-- > 1) {
Tcl_MutexUnlock(&preserveMutex);
return;
}
@@ -459,7 +459,7 @@ TclHandleRelease(
handlePtr, handlePtr->ptr2, handlePtr->ptr);
}
#endif
- if ((--handlePtr->refCount == 0) && (handlePtr->ptr == NULL)) {
+ if ((handlePtr->refCount-- <= 1) && (handlePtr->ptr == NULL)) {
ckfree(handlePtr);
}
}
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 0c73cba..bea3162 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -52,7 +52,7 @@ typedef struct {
* invoked step trace */
int curFlags; /* Trace flags for the current command */
int curCode; /* Return code for the current command */
- int refCount; /* Used to ensure this structure is not
+ size_t refCount; /* Used to ensure this structure is not
* deleted too early. Keeps track of how many
* pieces of code have a pointer to this
* structure. */