summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-05-08 22:13:13 (GMT)
committerhobbs <hobbs>2000-05-08 22:13:13 (GMT)
commitc00bcfc07587d60a89c06eb1145a62d5133919ae (patch)
tree97336b50f959a25ae16f52777e93ae31f99b2170 /generic/tclObj.c
parentc22aa1d594a279ae61e4e46b29975e9180ff0a63 (diff)
downloadtcl-c00bcfc07587d60a89c06eb1145a62d5133919ae.zip
tcl-c00bcfc07587d60a89c06eb1145a62d5133919ae.tar.gz
tcl-c00bcfc07587d60a89c06eb1145a62d5133919ae.tar.bz2
* generic/tclObj.c (Tcl_DuplicateObj): simplified code to call
TclInitStringRep, which the code was just duplicating in part.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c12
1 files 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) {