diff options
| author | dgp@users.sourceforge.net <dgp> | 2009-02-10 17:09:09 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2009-02-10 17:09:09 (GMT) |
| commit | 2832f16bed9f0f7651c151bb02fc7d0b8a119915 (patch) | |
| tree | f446e022b455265ddbae15598bce41cb7a9edf5b /generic/tclStringObj.c | |
| parent | 41961c7a2cfd4d63b6af628ef9f2068255e57721 (diff) | |
| download | tcl-2832f16bed9f0f7651c151bb02fc7d0b8a119915.zip tcl-2832f16bed9f0f7651c151bb02fc7d0b8a119915.tar.gz tcl-2832f16bed9f0f7651c151bb02fc7d0b8a119915.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; |
