summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-02-10 17:37:35 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-02-10 17:37:35 (GMT)
commit0de29ee94bd90a5b0401dd31599c0c5a44c387e2 (patch)
tree833212d6baee4dbeccaa67d27edb81e289350c76 /generic/tclStringObj.c
parentd1aef8650a1ebf59f57b1c605264aadcc928fa57 (diff)
downloadtcl-0de29ee94bd90a5b0401dd31599c0c5a44c387e2.zip
tcl-0de29ee94bd90a5b0401dd31599c0c5a44c387e2.tar.gz
tcl-0de29ee94bd90a5b0401dd31599c0c5a44c387e2.tar.bz2
Simplify Tcl_SetObjLength by removing unreachable code.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 15ed7af..940e6d1 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -33,7 +33,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStringObj.c,v 1.92 2009/02/10 17:28:37 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.93 2009/02/10 17:37:35 dgp Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -807,16 +807,9 @@ Tcl_SetObjLength(
*/
if (objPtr->bytes != tclEmptyStringRep) {
- objPtr->bytes = ckrealloc((char *) objPtr->bytes,
- (unsigned) (length + 1));
+ objPtr->bytes = ckrealloc(objPtr->bytes, (unsigned) length+1);
} else {
- char *newBytes = ckalloc((unsigned) (length+1));
-
- if (objPtr->bytes != NULL && objPtr->length != 0) {
- memcpy(newBytes, objPtr->bytes, (size_t) objPtr->length);
- TclInvalidateStringRep(objPtr);
- }
- objPtr->bytes = newBytes;
+ objPtr->bytes = ckalloc((unsigned) length+1);
}
stringPtr->allocated = length;