summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-03-21 18:02:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-03-21 18:02:49 (GMT)
commit1daf7b251b3f3c433644a0298c902c1c3032aa4d (patch)
tree15313c19062f14adf25226dab2cc03675bf43831 /generic/tclStringObj.c
parent02f9ee42d9908ad9e6c31c5c43aec3c3c65b3390 (diff)
downloadtcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.zip
tcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.tar.gz
tcl-1daf7b251b3f3c433644a0298c902c1c3032aa4d.tar.bz2
* generic/tclExecute.c: More ckalloc -> ckrealloc conversions.
* generic/tclLiteral.c: * generic/tclNamesp.c: * generic/tclParse.c: * generic/tclPreserve.c: * generic/tclStringObj.c: * generic/tclUtil.c:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index ea76330..f3aa3ab 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.63 2006/11/15 20:08:45 dgp Exp $ */
+ * RCS: @(#) $Id: tclStringObj.c,v 1.64 2007/03/21 18:02:51 dgp Exp $ */
#include "tclInt.h"
#include "tommath.h"
@@ -761,25 +761,24 @@ Tcl_SetObjLength(
if (length > (int) stringPtr->allocated &&
(objPtr->bytes != NULL || stringPtr->hasUnicode == 0)) {
- char *new;
/*
* Not enough space in current string. Reallocate the string space and
* free the old string.
*/
- if (objPtr->bytes != tclEmptyStringRep && objPtr->bytes != NULL) {
- new = (char *) ckrealloc((char *)objPtr->bytes,
+ if (objPtr->bytes != tclEmptyStringRep) {
+ objPtr->bytes = ckrealloc((char *)objPtr->bytes,
(unsigned)(length+1));
} else {
- new = (char *) ckalloc((unsigned) (length+1));
+ char *new = ckalloc((unsigned) (length+1));
if (objPtr->bytes != NULL && objPtr->length != 0) {
memcpy((void *) new, (void *) objPtr->bytes,
(size_t) objPtr->length);
Tcl_InvalidateStringRep(objPtr);
}
+ objPtr->bytes = new;
}
- objPtr->bytes = new;
stringPtr->allocated = length;
/*
@@ -884,14 +883,13 @@ Tcl_AttemptSetObjLength(
* free the old string.
*/
- if (objPtr->bytes != tclEmptyStringRep && objPtr->bytes != NULL) {
- new = (char *) attemptckrealloc((char *)objPtr->bytes,
- (unsigned)(length+1));
+ if (objPtr->bytes != tclEmptyStringRep) {
+ new = attemptckrealloc(objPtr->bytes, (unsigned)(length+1));
if (new == NULL) {
return 0;
}
} else {
- new = (char *) attemptckalloc((unsigned) (length+1));
+ new = attemptckalloc((unsigned) (length+1));
if (new == NULL) {
return 0;
}