From d82020da83cafa45be8a1030ae1ab6a05b630d48 Mon Sep 17 00:00:00 2001 From: hobbs Date: Mon, 8 May 2000 22:13:12 +0000 Subject: * generic/tclObj.c (Tcl_DuplicateObj): simplified code to call TclInitStringRep, which the code was just duplicating in part. FossilOrigin-Name: b7f61c313172adfe4561a24e02515df028286198 --- generic/tclObj.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/generic/tclObj.c b/generic/tclObj.c index 5b3fec7..73d8cce 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.12 1999/12/04 06:15:41 hobbs Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.13 2000/05/08 22:13:13 hobbs Exp $ */ #include "tclInt.h" @@ -648,15 +648,7 @@ Tcl_DuplicateObj(objPtr) if (objPtr->bytes == NULL) { dupPtr->bytes = NULL; } else if (objPtr->bytes != tclEmptyStringRep) { - int len = objPtr->length; - - dupPtr->bytes = (char *) ckalloc((unsigned) len+1); - if (len > 0) { - memcpy((VOID *) dupPtr->bytes, (VOID *) objPtr->bytes, - (unsigned) len); - } - dupPtr->bytes[len] = '\0'; - dupPtr->length = len; + TclInitStringRep(dupPtr, objPtr->bytes, objPtr->length); } if (typePtr != NULL) { -- cgit v0.12