diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-24 11:57:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-24 11:57:07 (GMT) |
commit | 2290210ff1e4282f665fd6b6dfaf4142220f5559 (patch) | |
tree | b9febc0881a58eee6a89d5510caaed05af60b537 | |
parent | 53f3b03647b0cc4baaac0fea20bcbf36f3a06702 (diff) | |
parent | c8d9ab8790cf3ce9e8a7ef9bc1593d7ad97a94cc (diff) | |
download | tcl-2290210ff1e4282f665fd6b6dfaf4142220f5559.zip tcl-2290210ff1e4282f665fd6b6dfaf4142220f5559.tar.gz tcl-2290210ff1e4282f665fd6b6dfaf4142220f5559.tar.bz2 |
merge trunk.
Make epoch in Tcl_DictSearch "unsigned int". This doubles the epoch range here. Use 0 as special value in stead of -1 (so start counting epoch's with 1).
-rw-r--r-- | generic/tcl.h | 15 | ||||
-rw-r--r-- | generic/tclCmdMZ.c | 2 | ||||
-rw-r--r-- | generic/tclDictObj.c | 36 | ||||
-rw-r--r-- | generic/tclLoad.c | 2 | ||||
-rw-r--r-- | generic/tclPipe.c | 2 | ||||
-rw-r--r-- | tests/tm.test | 5 |
6 files changed, 28 insertions, 34 deletions
diff --git a/generic/tcl.h b/generic/tcl.h index 0b222d7..3d571a6 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -631,19 +631,20 @@ typedef struct Tcl_Obj { union { /* The internal representation: */ long longValue; /* - an long integer value. */ double doubleValue; /* - a double-precision floating value. */ - void *otherValuePtr; /* - another, type-specific value, - not used internally any more. */ + void *otherValuePtr; /* - another, type-specific value, not used + * internally any more. */ Tcl_WideInt wideValue; /* - a long long value. */ struct { /* - internal rep as two pointers. - * the main use of which is a bignum's + * Many uses in Tcl, including a bignum's * tightly packed fields, where the alloc, * used and signum flags are packed into - * ptr2 with everything else hung off ptr1. */ + * ptr2 with everything else hung off + * ptr1. */ void *ptr1; void *ptr2; } twoPtrValue; struct { /* - internal rep as a pointer and a long, - not used internally any more. */ + * not used internally any more. */ void *ptr; unsigned long value; } ptrAndLongRep; @@ -1121,8 +1122,8 @@ typedef struct Tcl_HashSearch { typedef struct { void *next; /* Search position for underlying hash * table. */ - int epoch; /* Epoch marker for dictionary being searched, - * or -1 if search has terminated. */ + unsigned int epoch; /* Epoch marker for dictionary being searched, + * or 0 if search has terminated. */ Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ } Tcl_DictSearch; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 41f1f61..bb60697 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -323,7 +323,7 @@ Tcl_RegexpObjCmd( if (match == 0) { /* - * We want to set the value of the intepreter result only when + * We want to set the value of the interpreter result only when * this is the first time through the loop. */ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 9fad0c8..ea3be1a 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -141,8 +141,8 @@ typedef struct Dict { * the dictionary. Used for doing traversal of * the entries in the order that they are * created. */ - int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + unsigned int epoch; /* Epoch counter */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -390,9 +390,9 @@ DupDictInternalRep( * Initialise other fields. */ - newDict->epoch = 0; + newDict->epoch = 1; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -427,8 +427,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -708,9 +707,9 @@ SetDictFromAny( */ TclFreeIntRep(objPtr); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1107,14 +1106,14 @@ Tcl_DictObjFirst( dict = DICT(dictPtr); cPtr = dict->entryChainHead; if (cPtr == NULL) { - searchPtr->epoch = -1; + searchPtr->epoch = 0; *donePtr = 1; } else { *donePtr = 0; searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1168,7 +1167,7 @@ Tcl_DictObjNext( * If the searh is done; we do no work. */ - if (searchPtr->epoch == -1) { + if (searchPtr->epoch == 0) { *donePtr = 1; return; } @@ -1225,11 +1224,10 @@ Tcl_DictObjDone( { Dict *dict; - if (searchPtr->epoch != -1) { - searchPtr->epoch = -1; + if (searchPtr->epoch != 0) { + searchPtr->epoch = 0; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1379,9 +1377,9 @@ Tcl_NewDictObj(void) TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1429,9 +1427,9 @@ Tcl_DbNewDictObj( TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 893ff9c..418094e 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -1025,7 +1025,7 @@ Tcl_StaticPackage( * TclGetLoadedPackages -- * * This function returns information about all of the files that are - * loaded (either in a particular intepreter, or for all interpreters). + * loaded (either in a particular interpreter, or for all interpreters). * * Results: * The return value is a standard Tcl completion code. If successful, a diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 83fb818..d6cd188 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -60,7 +60,7 @@ static TclFile FileForRedirect(Tcl_Interp *interp, const char *spec, static TclFile FileForRedirect( - Tcl_Interp *interp, /* Intepreter to use for error reporting. */ + Tcl_Interp *interp, /* Interpreter to use for error reporting. */ const char *spec, /* Points to character just after redirection * character. */ int atOK, /* Non-zero means that '@' notation can be diff --git a/tests/tm.test b/tests/tm.test index dac7e5c..567d351 100644 --- a/tests/tm.test +++ b/tests/tm.test @@ -202,11 +202,6 @@ proc genpaths {base} { set base [file normalize $base] lassign [split [package present Tcl] .] major minor set results {} - set base8 [file join $base tcl8] - lappend results [file join $base8 site-tcl] - for {set i 0} {$i <= 7} {incr i} { - lappend results [file join $base8 8.$i] - } set base [file join $base tcl$major] lappend results [file join $base site-tcl] for {set i 0} {$i <= $minor} {incr i} { |