summaryrefslogtreecommitdiffstats
path: root/generic/tclDictObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclDictObj.c')
-rw-r--r--generic/tclDictObj.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index ae35d6b..8bf8373 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -149,18 +149,18 @@ const Tcl_ObjType tclDictType = {
SetDictFromAny /* setFromAnyProc */
};
-#define DictSetIntRep(objPtr, dictRepPtr) \
+#define DictSetInternalRep(objPtr, dictRepPtr) \
do { \
- Tcl_ObjIntRep ir; \
+ Tcl_ObjInternalRep ir; \
ir.twoPtrValue.ptr1 = (dictRepPtr); \
ir.twoPtrValue.ptr2 = NULL; \
- Tcl_StoreIntRep((objPtr), &tclDictType, &ir); \
+ Tcl_StoreInternalRep((objPtr), &tclDictType, &ir); \
} while (0)
-#define DictGetIntRep(objPtr, dictRepPtr) \
+#define DictGetInternalRep(objPtr, dictRepPtr) \
do { \
- const Tcl_ObjIntRep *irPtr; \
- irPtr = TclFetchIntRep((objPtr), &tclDictType); \
+ const Tcl_ObjInternalRep *irPtr; \
+ irPtr = TclFetchInternalRep((objPtr), &tclDictType); \
(dictRepPtr) = irPtr ? (Dict *)irPtr->twoPtrValue.ptr1 : NULL; \
} while (0)
@@ -362,7 +362,7 @@ DupDictInternalRep(
Dict *oldDict, *newDict = (Dict *)ckalloc(sizeof(Dict));
ChainEntry *cPtr;
- DictGetIntRep(srcPtr, oldDict);
+ DictGetInternalRep(srcPtr, oldDict);
/*
* Copy values across from the old hash table.
@@ -395,7 +395,7 @@ DupDictInternalRep(
* Store in the object.
*/
- DictSetIntRep(copyPtr, newDict);
+ DictSetInternalRep(copyPtr, newDict);
}
/*
@@ -422,7 +422,7 @@ FreeDictInternalRep(
{
Dict *dict;
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
if (dict->refCount-- <= 1) {
DeleteDict(dict);
@@ -499,7 +499,7 @@ UpdateStringOfDict(
int numElems;
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
assert (dict != NULL);
@@ -566,6 +566,7 @@ UpdateStringOfDict(
dst += TclConvertElement(elem, length, dst, flagPtr[i+1]);
*dst++ = ' ';
}
+ /* Last space overwrote the terminating NUL; cal T_ISR again to restore */
(void)Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1);
if (flagPtr != localFlags) {
@@ -610,7 +611,7 @@ SetDictFromAny(
* the conversion from lists to dictionaries.
*/
- if (TclHasIntRep(objPtr, &tclListType)) {
+ if (TclHasInternalRep(objPtr, &tclListType)) {
int objc, i;
Tcl_Obj **objv;
@@ -717,7 +718,7 @@ SetDictFromAny(
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
- DictSetIntRep(objPtr, dict);
+ DictSetInternalRep(objPtr, dict);
return TCL_OK;
missingValue:
@@ -739,12 +740,12 @@ GetDictFromObj(
{
Dict *dict;
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
if (dict == NULL) {
if (SetDictFromAny(interp, dictPtr) != TCL_OK) {
return NULL;
}
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
}
return dict;
}
@@ -792,12 +793,12 @@ TclTraceDictPath(
Dict *dict, *newDict;
int i;
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
if (dict == NULL) {
if (SetDictFromAny(interp, dictPtr) != TCL_OK) {
return NULL;
}
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
}
if (flags & DICT_PATH_UPDATE) {
dict->chain = NULL;
@@ -835,7 +836,7 @@ TclTraceDictPath(
} else {
tmpObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
- DictGetIntRep(tmpObj, newDict);
+ DictGetInternalRep(tmpObj, newDict);
if (newDict == NULL) {
if (SetDictFromAny(interp, tmpObj) != TCL_OK) {
@@ -844,7 +845,7 @@ TclTraceDictPath(
}
}
- DictGetIntRep(tmpObj, newDict);
+ DictGetInternalRep(tmpObj, newDict);
if (flags & DICT_PATH_UPDATE) {
if (Tcl_IsShared(tmpObj)) {
TclDecrRefCount(tmpObj);
@@ -852,7 +853,7 @@ TclTraceDictPath(
Tcl_IncrRefCount(tmpObj);
Tcl_SetHashValue(hPtr, tmpObj);
dict->epoch++;
- DictGetIntRep(tmpObj, newDict);
+ DictGetInternalRep(tmpObj, newDict);
}
newDict->chain = dictPtr;
@@ -889,14 +890,14 @@ InvalidateDictChain(
{
Dict *dict;
- DictGetIntRep(dictObj, dict);
+ DictGetInternalRep(dictObj, dict);
assert( dict != NULL);
do {
dict->refCount++;
TclInvalidateStringRep(dictObj);
- TclFreeIntRep(dictObj);
- DictSetIntRep(dictObj, dict);
+ TclFreeInternalRep(dictObj);
+ DictSetInternalRep(dictObj, dict);
dict->epoch++;
dictObj = dict->chain;
@@ -904,7 +905,7 @@ InvalidateDictChain(
break;
}
dict->chain = NULL;
- DictGetIntRep(dictObj, dict);
+ DictGetInternalRep(dictObj, dict);
} while (dict != NULL);
}
@@ -950,8 +951,8 @@ Tcl_DictObjPut(
TclInvalidateStringRep(dictPtr);
hPtr = CreateChainEntry(dict, keyPtr, &isNew);
dict->refCount++;
- TclFreeIntRep(dictPtr)
- DictSetIntRep(dictPtr, dict);
+ TclFreeInternalRep(dictPtr)
+ DictSetInternalRep(dictPtr, dict);
Tcl_IncrRefCount(valuePtr);
if (!isNew) {
Tcl_Obj *oldValuePtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
@@ -1306,7 +1307,7 @@ Tcl_DictObjPutKeyList(
return TCL_ERROR;
}
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
assert(dict != NULL);
hPtr = CreateChainEntry(dict, keyv[keyc-1], &isNew);
Tcl_IncrRefCount(valuePtr);
@@ -1364,7 +1365,7 @@ Tcl_DictObjRemoveKeyList(
return TCL_ERROR;
}
- DictGetIntRep(dictPtr, dict);
+ DictGetInternalRep(dictPtr, dict);
assert(dict != NULL);
DeleteChainEntry(dict, keyv[keyc-1]);
InvalidateDictChain(dictPtr);
@@ -1411,7 +1412,7 @@ Tcl_NewDictObj(void)
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
- DictSetIntRep(dictPtr, dict);
+ DictSetInternalRep(dictPtr, dict);
return dictPtr;
#endif
}
@@ -1459,7 +1460,7 @@ Tcl_DbNewDictObj(
dict->epoch = 1;
dict->chain = NULL;
dict->refCount = 1;
- DictSetIntRep(dictPtr, dict);
+ DictSetInternalRep(dictPtr, dict);
return dictPtr;
}
#else /* !TCL_MEM_DEBUG */