diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-16 15:34:14 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-16 15:34:14 (GMT) |
| commit | 9672bba339c071de7231ea922f64efdc6ba182a8 (patch) | |
| tree | 2094bf1c1ec5eb710729c2f1b62e420eb1f07826 | |
| parent | fd3fbe8801d5ad9b3e3653e77d83149f1e8d09d6 (diff) | |
| download | tcl-9672bba339c071de7231ea922f64efdc6ba182a8.zip tcl-9672bba339c071de7231ea922f64efdc6ba182a8.tar.gz tcl-9672bba339c071de7231ea922f64efdc6ba182a8.tar.bz2 | |
Change TclOO epoch fields from int to size_t.
| -rw-r--r-- | generic/tclOO.c | 7 | ||||
| -rw-r--r-- | generic/tclOOCall.c | 6 | ||||
| -rw-r--r-- | generic/tclOOInt.h | 14 |
3 files changed, 14 insertions, 13 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index e48158c..216219d 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -334,7 +334,7 @@ InitFoundation( DeletedObjdefNamespace); fPtr->helpersNs = Tcl_CreateNamespace(interp, "::oo::Helpers", fPtr, DeletedHelpersNamespace); - fPtr->epoch = 0; + fPtr->epoch = 1; fPtr->tsdPtr = tsdPtr; TclNewLiteralStringObj(fPtr->unknownMethodNameObj, "unknown"); TclNewLiteralStringObj(fPtr->constructorName, "<constructor>"); @@ -562,7 +562,8 @@ AllocObject( Object *oPtr; Command *cmdPtr; CommandTrace *tracePtr; - int creationEpoch, ignored; + size_t creationEpoch; + int ignored; oPtr = ckalloc(sizeof(Object)); memset(oPtr, 0, sizeof(Object)); @@ -592,7 +593,7 @@ AllocObject( while (1) { char objName[10 + TCL_INTEGER_SPACE]; - sprintf(objName, "::oo::Obj%d", ++fPtr->tsdPtr->nsCount); + sprintf(objName, "::oo::Obj%" TCL_LL_MODIFIER "d", (Tcl_WideInt)++fPtr->tsdPtr->nsCount); oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, ObjectNamespaceDeleted); if (oPtr->namespacePtr != NULL) { diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index d4e1e34..2a63e6c 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -1055,7 +1055,7 @@ TclOOGetCallContext( AddSimpleChainToCallContext(oPtr, oPtr->fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL); callPtr->flags |= OO_UNKNOWN_METHOD; - callPtr->epoch = -1; + callPtr->epoch = 0; if (callPtr->numChain == 0) { TclOODeleteChain(callPtr); return NULL; @@ -1125,7 +1125,7 @@ TclOOGetCallContext( AddSimpleChainToCallContext(oPtr, oPtr->fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL); callPtr->flags |= OO_UNKNOWN_METHOD; - callPtr->epoch = -1; + callPtr->epoch = 0; if (count == callPtr->numChain) { TclOODeleteChain(callPtr); return NULL; @@ -1292,7 +1292,7 @@ TclOOGetStereotypeCallChain( AddSimpleChainToCallContext(&obj, fPtr->unknownMethodNameObj, &cb, NULL, 0, NULL); callPtr->flags |= OO_UNKNOWN_METHOD; - callPtr->epoch = -1; + callPtr->epoch = 0; if (count == callPtr->numChain) { TclOODeleteChain(callPtr); return NULL; diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 11ba698..9e73fdf 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -170,9 +170,9 @@ typedef struct Object { * references; this mechanism exists to * avoid Tcl_Preserve. */ int flags; - int creationEpoch; /* Unique value to make comparisons of objects + size_t creationEpoch; /* Unique value to make comparisons of objects * easier. */ - int epoch; /* Per-object epoch, incremented when the way + size_t epoch; /* Per-object epoch, incremented when the way * an object should resolve call chains is * changed. */ Tcl_HashTable *metadataPtr; /* Mapping from pointers to metadata type to @@ -282,7 +282,7 @@ typedef struct Class { */ typedef struct ThreadLocalData { - int nsCount; /* Master epoch counter is used for keeping + size_t nsCount; /* Master epoch counter is used for keeping * the values used in Tcl_Obj internal * representations sane. Must be thread-local * because Tcl_Objs can cross interpreter @@ -306,7 +306,7 @@ typedef struct Foundation { Tcl_Namespace *helpersNs; /* Namespace containing the commands that are * only valid when executing inside a * procedural method. */ - int epoch; /* Used to invalidate method chains when the + size_t epoch; /* Used to invalidate method chains when the * class structure changes. */ ThreadLocalData *tsdPtr; /* Counter so we can allocate a unique * namespace to each object. */ @@ -340,12 +340,12 @@ struct MInvoke { }; typedef struct CallChain { - int objectCreationEpoch; /* The object's creation epoch. Note that the + size_t objectCreationEpoch; /* The object's creation epoch. Note that the * object reference is not stored in the call * chain; it is in the call context. */ - int objectEpoch; /* Local (object structure) epoch counter + size_t objectEpoch; /* Local (object structure) epoch counter * snapshot. */ - int epoch; /* Global (class structure) epoch counter + size_t epoch; /* Global (class structure) epoch counter * snapshot. */ int flags; /* Assorted flags, see below. */ int refCount; /* Reference count. */ |
