summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 2b0fb72..1d5e8fe 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3653,17 +3653,16 @@ static void
UpdateStringOfEndOffset(
register Tcl_Obj *objPtr)
{
- char buffer[TCL_INTEGER_SPACE + 5];
- register int len = 3;
+ char *dst = Tcl_InitStringRep(objPtr, NULL, TCL_INTEGER_SPACE + 5);
+ int len = 3;
- memcpy(buffer, "end", 4);
+ memcpy(dst, "end", len);
if (objPtr->internalRep.longValue != 0) {
- buffer[len++] = '-';
- len += TclFormatInt(buffer+len, -(objPtr->internalRep.longValue));
+ dst[len++] = '-';
+ len += TclFormatInt(dst+len, -(objPtr->internalRep.longValue));
}
- objPtr->bytes = ckalloc((unsigned) len+1);
- memcpy(objPtr->bytes, buffer, (unsigned) len+1);
- objPtr->length = len;
+
+ (void) Tcl_InitStringRep(objPtr, NULL, len);
}
/*