diff options
author | dgp <dgp@users.sourceforge.net> | 2009-02-10 17:09:09 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-02-10 17:09:09 (GMT) |
commit | 53dbabfac015bf2ff02f18a116d9543d1bfb90c9 (patch) | |
tree | f446e022b455265ddbae15598bce41cb7a9edf5b /generic/tclStringObj.c | |
parent | 7b3c951b15a0055349ce9b6514624ea3eee60caa (diff) | |
download | tcl-53dbabfac015bf2ff02f18a116d9543d1bfb90c9.zip tcl-53dbabfac015bf2ff02f18a116d9543d1bfb90c9.tar.gz tcl-53dbabfac015bf2ff02f18a116d9543d1bfb90c9.tar.bz2 |
* generic/tclObj.c (Tcl_GetString): Added comments and validity
checks following the call to an UpdateStringProc.
Simplify Tcl_AttemptSetObjLength by removing unreachable code.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 2b0157e..eef8b1d 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.90 2009/02/10 15:37:19 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.91 2009/02/10 17:09:09 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -930,18 +930,11 @@ Tcl_AttemptSetObjLength( if (objPtr->bytes != tclEmptyStringRep) { newBytes = attemptckrealloc(objPtr->bytes, (unsigned) length+1); - if (newBytes == NULL) { - return 0; - } } else { newBytes = attemptckalloc((unsigned) length+1); - if (newBytes == NULL) { - return 0; - } - if (objPtr->bytes != NULL && objPtr->length != 0) { - memcpy(newBytes, objPtr->bytes, (size_t) objPtr->length); - TclInvalidateStringRep(objPtr); - } + } + if (newBytes == NULL) { + return 0; } objPtr->bytes = newBytes; stringPtr->allocated = length; |