diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-24 12:59:55 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-24 12:59:55 (GMT) |
commit | 20b89e16049a89c0fba39bf0762494140bd14663 (patch) | |
tree | ab544cdb608081dd40b2a2edd45759d8f48154f2 | |
parent | e20374dc6289dbcbd8a89d665c7aa418934ef59b (diff) | |
download | tcl-20b89e16049a89c0fba39bf0762494140bd14663.zip tcl-20b89e16049a89c0fba39bf0762494140bd14663.tar.gz tcl-20b89e16049a89c0fba39bf0762494140bd14663.tar.bz2 |
More (internal) size_t usage in TclOO
-rw-r--r-- | generic/tclExecute.c | 6 | ||||
-rw-r--r-- | generic/tclOO.c | 4 | ||||
-rw-r--r-- | generic/tclOOBasic.c | 6 | ||||
-rw-r--r-- | generic/tclOOCall.c | 13 | ||||
-rw-r--r-- | generic/tclOOInt.h | 6 | ||||
-rw-r--r-- | generic/tclOOMethod.c | 3 |
6 files changed, 20 insertions, 18 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 3876ff7..bea9798 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -4349,7 +4349,7 @@ TEBCresume( Object *oPtr; CallFrame *framePtr; CallContext *contextPtr; - int skip, newDepth; + size_t skip, newDepth; case INST_TCLOO_SELF: framePtr = iPtr->varFramePtr; @@ -4401,7 +4401,7 @@ TEBCresume( } else { Class *classPtr = oPtr->classPtr; struct MInvoke *miPtr; - int i; + size_t i; const char *methodType; if (classPtr == NULL) { @@ -4450,7 +4450,7 @@ TEBCresume( TRACE_APPEND(("ERROR: \"%.30s\" not on reachable chain\n", O2S(valuePtr))); - for (i=contextPtr->index ; i>=0 ; i--) { + for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) { miPtr = contextPtr->callPtr->chain + i; if (miPtr->isFilter || miPtr->mPtr->declaringClassPtr != classPtr) { diff --git a/generic/tclOO.c b/generic/tclOO.c index b9c976e..f90025d 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -2799,8 +2799,8 @@ Tcl_ObjectContextInvokeNext( int skip) { CallContext *contextPtr = (CallContext *) context; - int savedIndex = contextPtr->index; - int savedSkip = contextPtr->skip; + size_t savedIndex = contextPtr->index; + size_t savedSkip = contextPtr->skip; int result; if (contextPtr->index + 1 >= contextPtr->callPtr->numChain) { diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index eb929c8..41ce034 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -909,7 +909,7 @@ TclOONextToObjCmd( CallFrame *framePtr = iPtr->varFramePtr; Class *classPtr; CallContext *contextPtr; - int i; + size_t i; Tcl_Object object; const char *methodType; @@ -985,7 +985,7 @@ TclOONextToObjCmd( methodType = "method"; } - for (i=contextPtr->index ; i>=0 ; i--) { + for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) { struct MInvoke *miPtr = contextPtr->callPtr->chain + i; if (!miPtr->isFilter && miPtr->mPtr->declaringClassPtr == classPtr) { @@ -1218,7 +1218,7 @@ TclOOSelfObjCmd( } else { Method *mPtr; Object *declarerPtr; - int i; + size_t i; for (i=contextPtr->index ; i<contextPtr->callPtr->numChain ; i++){ if (!contextPtr->callPtr->chain[i].isFilter) { diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 60666f4..dbc4789 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -24,7 +24,7 @@ struct ChainBuilder { CallChain *callChainPtr; /* The call chain being built. */ - int filterLength; /* Number of entries in the call chain that + size_t filterLength; /* Number of entries in the call chain that * are due to processing filters and not the * main call chain. */ Object *oPtr; /* The object that we are building the chain @@ -326,7 +326,7 @@ TclOOInvokeContext( */ if (contextPtr->index == 0) { - int i; + size_t i; for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) { AddRef(contextPtr->callPtr->chain[i].mPtr); @@ -404,7 +404,7 @@ FinalizeMethodRefs( int result) { CallContext *contextPtr = (CallContext *)data[0]; - int i; + size_t i; for (i = 0 ; i < contextPtr->callPtr->numChain ; i++) { TclOODelMethodRef(contextPtr->callPtr->chain[i].mPtr); @@ -969,7 +969,7 @@ AddMethodToCallChain( * not passed a mixin. */ { CallChain *callPtr = cbPtr->callChainPtr; - int i; + size_t i; /* * Return if this is just an entry used to record whether this is a public @@ -1408,7 +1408,7 @@ TclOOGetStereotypeCallChain( { CallChain *callPtr; struct ChainBuilder cb; - int i, count; + size_t count; Foundation *fPtr = clsPtr->thisPtr->fPtr; Tcl_HashEntry *hPtr; Tcl_HashTable doneFilters; @@ -1504,12 +1504,13 @@ TclOOGetStereotypeCallChain( } } else { if (hPtr == NULL) { + int isNew; if (clsPtr->classChainCache == NULL) { clsPtr->classChainCache = (Tcl_HashTable *)Tcl_Alloc(sizeof(Tcl_HashTable)); Tcl_InitObjHashTable(clsPtr->classChainCache); } hPtr = Tcl_CreateHashEntry(clsPtr->classChainCache, - (char *) methodNameObj, &i); + (char *) methodNameObj, &isNew); } callPtr->refCount++; Tcl_SetHashValue(hPtr, callPtr); diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 342def6..4ad84a6 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -396,7 +396,7 @@ typedef struct CallChain { * snapshot. */ int flags; /* Assorted flags, see below. */ size_t refCount; /* Reference count. */ - int numChain; /* Size of the call chain. */ + size_t numChain; /* Size of the call chain. */ struct MInvoke *chain; /* Array of call chain entries. May point to * staticChain if the number of entries is * small. */ @@ -405,9 +405,9 @@ typedef struct CallChain { typedef struct CallContext { Object *oPtr; /* The object associated with this call. */ - int index; /* Index into the call chain of the currently + size_t index; /* Index into the call chain of the currently * executing method implementation. */ - int skip; /* Current number of arguments to skip; can + size_t skip; /* Current number of arguments to skip; can * vary depending on whether it is a direct * method call or a continuation via the * [next] command. */ diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index b205043..a09ae1b 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1468,7 +1468,8 @@ InvokeForwardMethod( CallContext *contextPtr = (CallContext *) context; ForwardMethod *fmPtr = (ForwardMethod *)clientData; Tcl_Obj **argObjs, **prefixObjs; - int numPrefixes, len, skip = contextPtr->skip; + size_t numPrefixes, skip = contextPtr->skip; + int len; /* * Build the real list of arguments to use. Note that we know that the |