summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 3ce22f0..25f8a61 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -35,7 +35,7 @@
#include "tclInt.h"
#include "tclTomMath.h"
#include "tclStringRep.h"
-#include "assert.h"
+#include <assert.h>
/*
* Prototypes for functions defined later in this file:
*/
@@ -835,9 +835,9 @@ TclGetUniChar(
if (stringPtr->numChars == TCL_INDEX_NONE) {
TclNumUtfCharsM(stringPtr->numChars, objPtr->bytes, objPtr->length);
}
- if (index >= stringPtr->numChars) {
- return -1;
- }
+ if (index >= stringPtr->numChars) {
+ return -1;
+ }
if (stringPtr->numChars == objPtr->length) {
return (unsigned char) objPtr->bytes[index];
}
@@ -1550,7 +1550,7 @@ Tcl_AppendLimitedToObj(
TclGetUnicodeFromObj(objPtr, NULL);
stringPtr = GET_UNICHAR_STRING(objPtr);
}
- if (stringPtr->hasUnicode && stringPtr->numChars > 0) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars > 0)) {
AppendUtfToUnicodeRep(objPtr, bytes, toCopy);
} else {
AppendUtfToUtfRep(objPtr, bytes, toCopy);
@@ -1561,7 +1561,7 @@ Tcl_AppendLimitedToObj(
}
stringPtr = GET_UNICHAR_STRING(objPtr);
- if (stringPtr->hasUnicode && stringPtr->numChars > 0) {
+ if (stringPtr->hasUnicode && (stringPtr->numChars > 0)) {
AppendUtfToUnicodeRep(objPtr, ellipsis, eLen);
} else {
AppendUtfToUtfRep(objPtr, ellipsis, eLen);
@@ -3341,8 +3341,6 @@ TclStringRepeat(
Tcl_Size done = 1;
int binary = TclIsPureByteArray(objPtr);
- /* assert (count >= 2) */
-
/*
* Analyze to determine what representation result should be.
* GOALS: Avoid shimmering & string rep generation.
@@ -3411,7 +3409,7 @@ TclStringRepeat(
objResultPtr = objPtr;
}
- if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
+ if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"string size overflow: unable to alloc %"
@@ -3439,7 +3437,7 @@ TclStringRepeat(
TclFreeInternalRep(objPtr);
objResultPtr = objPtr;
}
- if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
+ if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"string size overflow: unable to alloc %" TCL_SIZE_MODIFIER "d bytes",
@@ -3491,8 +3489,6 @@ TclStringCat(
Tcl_Size last = 0; /* Index of last value possibly not empty */
int inPlace = flags & TCL_STRING_IN_PLACE;
- /* assert ( objc >= 0 ) */
-
if (objc <= 1) {
if (objc != 1) {
/* Negative (shouldn't be) no objects; return empty */
@@ -3504,8 +3500,6 @@ TclStringCat(
return objv[0];
}
- /* assert ( objc >= 2 ) */
-
/*
* Analyze to determine what representation result should be.
* GOALS: Avoid shimmering & string rep generation.
@@ -3536,7 +3530,6 @@ TclStringCat(
}
}
} else {
- /* assert (objPtr->typePtr != NULL) -- stork! */
binary = 0;
if (TclHasInternalRep(objPtr, &tclUniCharStringType)) {
/* Have a pure Unicode value; ask to preserve it */
@@ -3617,9 +3610,6 @@ TclStringCat(
*/
do {
- /* assert ( pendingPtr == NULL ) */
- /* assert ( length == 0 ) */
-
Tcl_Obj *objPtr = *ov++;
if (objPtr->bytes == NULL) {
@@ -3642,8 +3632,6 @@ TclStringCat(
if (oc && (length == 0)) {
Tcl_Size numBytes;
- /* assert ( pendingPtr != NULL ) */
-
/*
* There's a pending value followed by more values. Loop over
* remaining values generating strings until a non-empty value
@@ -3676,8 +3664,6 @@ TclStringCat(
Tcl_Size numBytes;
Tcl_Obj *objPtr = *ov++;
- /* assert ( length > 0 && pendingPtr == NULL ) */
-
TclGetStringFromObj(objPtr, &numBytes); /* PANIC? */
if (numBytes) {
last = objc - oc;
@@ -3805,7 +3791,6 @@ TclStringCat(
}
dst = Tcl_GetString(objResultPtr) + start;
- /* assert ( length > start ) */
TclFreeInternalRep(objResultPtr);
} else {
TclNewObj(objResultPtr); /* PANIC? */