diff options
author | dgp <dgp@users.sourceforge.net> | 2016-03-24 12:51:49 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-03-24 12:51:49 (GMT) |
commit | af138b22ab581412561847649ea0c71a86898bbb (patch) | |
tree | 31cc308c2a7efcde7b79a64bee694c3b35d9e004 /generic/tclUtil.c | |
parent | 0dcadf98b4e0b30fca2fb1b49a69011a4b3e91ff (diff) | |
download | tcl-af138b22ab581412561847649ea0c71a86898bbb.zip tcl-af138b22ab581412561847649ea0c71a86898bbb.tar.gz tcl-af138b22ab581412561847649ea0c71a86898bbb.tar.bz2 |
Revised "end-offset" Tcl_ObjType to use new routine.
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 15 |
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); } /* |