summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-06-16 15:19:41 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-06-16 15:19:41 (GMT)
commit9899c6d8097c67a31bc107c77ff8848bcc23d6db (patch)
treef824e5fe9e245730af806b3a5aabf69b2c8e1e08 /generic/tclUtil.c
parentb700360ad9501defb0b1e2d86353ac8d0db8eef4 (diff)
parent3f61f168eb9d98c28312cdea25b214827c3692f2 (diff)
downloadtcl-9899c6d8097c67a31bc107c77ff8848bcc23d6db.zip
tcl-9899c6d8097c67a31bc107c77ff8848bcc23d6db.tar.gz
tcl-9899c6d8097c67a31bc107c77ff8848bcc23d6db.tar.bz2
Merge up to a197e6853e. Still works. Next checkin restarts the segfaults.
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 13e54ec..27e2474 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -167,7 +167,7 @@ const Tcl_ObjType tclEndOffsetType = {
* separating whitespace, or a string terminator. It is just another
* character in a list element.
*
- * The interpretaton of a formatted substring as a list element follows rules
+ * The interpretation of a formatted substring as a list element follows rules
* similar to the parsing of the words of a command in a Tcl script. Backslash
* substitution plays a key role, and is defined exactly as it is in command
* parsing. The same routine, TclParseBackslash() is used in both command
@@ -179,7 +179,7 @@ const Tcl_ObjType tclEndOffsetType = {
* Backslash substitution replaces an "escape sequence" of one or more
* characters starting with
* \u005c \ BACKSLASH
- * with a single character. The one character escape sequent case happens only
+ * with a single character. The one character escape sequence case happens only
* when BACKSLASH is the last character in the string. In all other cases, the
* escape sequence is at least two characters long.
*
@@ -2927,14 +2927,16 @@ TclDStringToObj(
{
Tcl_Obj *result;
- if (dsPtr->length == 0) {
- TclNewObj(result);
- } else if (dsPtr->string == dsPtr->staticSpace) {
- /*
- * Static buffer, so must copy.
- */
-
- TclNewStringObj(result, dsPtr->string, dsPtr->length);
+ if (dsPtr->string == dsPtr->staticSpace) {
+ if (dsPtr->length == 0) {
+ TclNewObj(result);
+ } else {
+ /*
+ * Static buffer, so must copy.
+ */
+
+ TclNewStringObj(result, dsPtr->string, dsPtr->length);
+ }
} else {
/*
* Dynamic buffer, so transfer ownership and reset.