diff options
author | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:56:13 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-01-10 22:56:13 (GMT) |
commit | 5b78094ea6b2026c6b28ee878ad1c09b26946bd5 (patch) | |
tree | b67c333294838d4ba90e8b374a9bc80ae0d8ea8d | |
parent | 711d1c6a2168db11f4a5157d4cb75d5f9382ef6a (diff) | |
download | tcl-5b78094ea6b2026c6b28ee878ad1c09b26946bd5.zip tcl-5b78094ea6b2026c6b28ee878ad1c09b26946bd5.tar.gz tcl-5b78094ea6b2026c6b28ee878ad1c09b26946bd5.tar.bz2 |
Merge remote-tracking branch 'remotes/fossil/trunk' into sb/trunk-rewrite-clock-in-c; + minor fixes after merge.
-rw-r--r-- | generic/tclClock.c | 3 | ||||
-rw-r--r-- | generic/tclDate.h | 2 | ||||
-rw-r--r-- | generic/tclDictObj.c | 50 | ||||
-rw-r--r-- | library/msgcat/msgcat.tcl | 2 | ||||
-rw-r--r-- | win/makefile.vc | 4 |
5 files changed, 37 insertions, 24 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c index 1b1faae..a417758 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -309,8 +309,7 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - data->refCount--; - if (data->refCount == 0) { + if (data->refCount-- <= 1) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } diff --git a/generic/tclDate.h b/generic/tclDate.h index c9c6726..cf307a6 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -275,7 +275,7 @@ typedef struct ClockFmtScnCmdArgs { */ typedef struct ClockClientData { - int refCount; /* Number of live references. */ + size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 8e11bfe..caebbf1 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -145,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -395,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -430,8 +430,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -716,7 +715,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1120,7 +1119,7 @@ Tcl_DictObjFirst( 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); } @@ -1234,8 +1233,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1387,7 +1385,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1437,7 +1435,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1981,7 +1979,7 @@ Tcl_DictObjSmartRef( result = Tcl_NewObj(); DICT(result) = dict; - dict->refcount++; + dict->refCount++; result->internalRep.twoPtrValue.ptr2 = NULL; result->typePtr = &tclDictType; @@ -2355,7 +2353,7 @@ DictAppendCmd( Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; - int i, allocatedDict = 0; + int allocatedDict = 0; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2380,15 +2378,33 @@ DictAppendCmd( if ((objc > 3) || (valuePtr == NULL)) { /* Only go through append activites when something will change. */ + Tcl_Obj *appendObjPtr = NULL; - if (valuePtr == NULL) { + if (objc > 3) { + /* Something to append */ + + if (objc == 4) { + appendObjPtr = objv[3]; + } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, + objc-3, objv+3, &appendObjPtr)) { + return TCL_ERROR; + } + } + + if (appendObjPtr == NULL) { + /* => (objc == 3) => (valuePtr == NULL) */ TclNewObj(valuePtr); - } else if (Tcl_IsShared(valuePtr)) { - valuePtr = Tcl_DuplicateObj(valuePtr); + } else if (valuePtr == NULL) { + valuePtr = appendObjPtr; + appendObjPtr = NULL; } - for (i=3 ; i<objc ; i++) { - Tcl_AppendObjToObj(valuePtr, objv[i]); + if (appendObjPtr) { + if (Tcl_IsShared(valuePtr)) { + valuePtr = Tcl_DuplicateObj(valuePtr); + } + + Tcl_AppendObjToObj(valuePtr, appendObjPtr); } Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr); diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index e6452d2..1260139 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require Tcl 8.5 +package require Tcl 8.5- # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. package provide msgcat 1.6.0 diff --git a/win/makefile.vc b/win/makefile.vc index 48bacbc..aeb6c5a 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -484,9 +484,7 @@ cdebug = $(cdebug) -Zi ### Warnings are too many, can't support warnings into errors.
cdebug = -Zi -Od $(DEBUGFLAGS)
!else
-# no -WX option here (error C2220: warning treated as error):
-#cdebug = -Zi -WX $(DEBUGFLAGS)
-cdebug = -Zi $(DEBUGFLAGS)
+cdebug = -Zi -WX $(DEBUGFLAGS)
!endif
### Declarations common to all compiler options
|