diff options
Diffstat (limited to 'generic/tclStringObj.c')
| -rw-r--r-- | generic/tclStringObj.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0da5f04..5864ebc 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -157,8 +157,7 @@ GrowStringBuffer( */ if (flag == 0 || stringPtr->allocated > 0) { ptr = (char *)TclReallocEx(objPtr->bytes, needed, &capacity); - } - else { + } else { /* Allocate exact size */ ptr = (char *)Tcl_Realloc(objPtr->bytes, needed); capacity = needed; @@ -197,7 +196,10 @@ GrowUnicodeBuffer( maxChars -= 1; /* End nul not included */ } else { - /* First allocation - just big enough */ + /* + * First allocation - just big enough. Note needed does + * not include terminating nul but STRING_SIZE does + */ stringPtr = (String *)Tcl_Realloc(stringPtr, STRING_SIZE(needed)); maxChars = needed; } |
