summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-11-06 09:51:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-11-06 09:51:55 (GMT)
commit2798a075ee62ea5ab4aa80279d614a8634ba378a (patch)
tree0a09cb9e38547d3b35e396717c0b04302eb5bd8a /generic/tclUtil.c
parent5429d6aeaf940119a7a7bb0a3d54ae966c234314 (diff)
parentf7dfeb706fb75bccd0aae6cd6119fccdfb6bd8d0 (diff)
downloadtcl-2798a075ee62ea5ab4aa80279d614a8634ba378a.zip
tcl-2798a075ee62ea5ab4aa80279d614a8634ba378a.tar.gz
tcl-2798a075ee62ea5ab4aa80279d614a8634ba378a.tar.bz2
Implement TIP 445
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 76a3890..ef3c3dc 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1390,9 +1390,9 @@ TclConvertElement(
*/
if ((src == NULL) || (length == 0) || (*src == '\0' && length == -1)) {
- src = &tclEmptyString;
- length = 0;
- conversion = CONVERT_BRACE;
+ p[0] = '{';
+ p[1] = '}';
+ return 2;
}
/*
@@ -2089,7 +2089,7 @@ Tcl_ConcatObj(
resPtr = NULL;
for (i = 0; i < objc; i++) {
objPtr = objv[i];
- if (objPtr->bytes && objPtr->length == 0) {
+ if (!TclListObjIsCanonical(objPtr)) {
continue;
}
if (resPtr) {
@@ -3903,20 +3903,19 @@ TclGetIntForIndex(
}
return TCL_OK;
}
-
/*
*----------------------------------------------------------------------
*
* GetEndOffsetFromObj --
*
- * Look for a string of the form "end[+-]offset" and convert it to an
- * internal representation holding the offset.
+ * Look for a string of the form "end[+-]offset" and convert it to an
+ * internal representation holding the offset.
*
* Results:
- * Tcl return code.
+ * Tcl return code.
*
* Side effects:
- * May store a Tcl_ObjType.
+ * May store a Tcl_ObjType.
*
*----------------------------------------------------------------------
*/
@@ -3929,9 +3928,11 @@ GetEndOffsetFromObj(
Tcl_WideInt *widePtr) /* Location filled in with an integer
* representing an index. */
{
+ Tcl_ObjIntRep *irPtr;
Tcl_WideInt offset = 0; /* Offset in the "end-offset" expression */
- if (objPtr->typePtr != &endOffsetType) {
+ while ((irPtr = Tcl_FetchIntRep(objPtr, &endOffsetType)) == NULL) {
+ Tcl_ObjIntRep ir;
int length;
const char *bytes = TclGetStringFromObj(objPtr, &length);
@@ -3985,13 +3986,12 @@ GetEndOffsetFromObj(
}
}
- /* Success. Free the old internal rep and set the new one. */
- TclFreeIntRep(objPtr);
- objPtr->internalRep.wideValue = offset;
- objPtr->typePtr = &endOffsetType;
+ /* Success. Store the new internal rep. */
+ ir.wideValue = offset;
+ Tcl_StoreIntRep(objPtr, &endOffsetType, &ir);
}
- offset = objPtr->internalRep.wideValue;
+ offset = irPtr->wideValue;
if ((endValue ^ offset) < 0) {
/* Different signs, sum cannot overflow */