diff options
| author | dgp <dgp@users.sourceforge.net> | 2016-10-21 13:25:15 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2016-10-21 13:25:15 (GMT) |
| commit | 17cafef75540099a4b6ec57dc6f140f5651941c1 (patch) | |
| tree | 4a702ec0aa5b82c155ce3d6ebc0748d1066d9490 | |
| parent | 24109a18e449425f20102a95652e05e9dc073ffe (diff) | |
| parent | 79ff282b020e082cb97f5fccdb151a7beb7ac48c (diff) | |
| download | tcl-17cafef75540099a4b6ec57dc6f140f5651941c1.zip tcl-17cafef75540099a4b6ec57dc6f140f5651941c1.tar.gz tcl-17cafef75540099a4b6ec57dc6f140f5651941c1.tar.bz2 | |
merge trunk
| -rw-r--r-- | generic/tclCmdMZ.c | 4 | ||||
| -rw-r--r-- | generic/tclCompCmds.c | 11 | ||||
| -rw-r--r-- | generic/tclExecute.c | 19 | ||||
| -rw-r--r-- | tests/format.test | 7 | ||||
| -rw-r--r-- | tests/stringComp.test | 3 |
5 files changed, 16 insertions, 28 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index fc518ac..9a62fec 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1242,8 +1242,8 @@ StringFirstCmd( * Scan forward to find the first character. */ - if ((*p == *needleStr) && (TclUniCharNcmp(needleStr, p, - (unsigned long) needleLen) == 0)) { + if ((*p == *needleStr) && (memcmp(needleStr, p, + sizeof(Tcl_UniChar) * (size_t)needleLen) == 0)) { match = p - haystackStr; break; } diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index bce17dc..5f4c298 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3206,17 +3206,6 @@ TclCompileFormatCmd( */ TclEmitInstInt1(INST_STR_CONCAT1, i, envPtr); - } else { - /* - * EVIL HACK! Force there to be a string representation in the case - * where there's just a "%s" in the format; case covered by the test - * format-20.1 (and it is horrible...) - */ - - TclEmitOpcode(INST_DUP, envPtr); - PushStringLiteral(envPtr, ""); - TclEmitOpcode(INST_STR_EQ, envPtr); - TclEmitOpcode(INST_POP, envPtr); } return TCL_OK; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index e1d626f..2d53a87 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5579,17 +5579,6 @@ TEBCresume( length3 = Tcl_GetCharLength(value3Ptr); /* - * Remove substring. In-place. - */ - - if (length3 == 0 && !Tcl_IsShared(valuePtr) && toIdx == length) { - TclDecrRefCount(value3Ptr); - Tcl_SetObjLength(valuePtr, fromIdx); - TRACE_APPEND(("\"%.30s\"\n", O2S(valuePtr))); - NEXT_INST_F(1, 0, 0); - } - - /* * See if we can splice in place. This happens when the number of * characters being replaced is the same as the number of characters * in the string to be inserted. @@ -5663,10 +5652,14 @@ TEBCresume( /* which has result {} which is same as value3Ptr. */ objResultPtr = value3Ptr; } - if (objResultPtr != value3Ptr) { + if (objResultPtr == value3Ptr) { /* See [Bug 82e7f67325] */ - TclDecrRefCount(value3Ptr); + TclDecrRefCount(OBJ_AT_TOS); + OBJ_AT_TOS = value3Ptr; + TRACE_APPEND(("\"%.30s\"\n", O2S(value3Ptr))); + NEXT_INST_F(1, 0, 0); } + TclDecrRefCount(value3Ptr); TRACE_APPEND(("\"%.30s\"\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); diff --git a/tests/format.test b/tests/format.test index 27eac31..e199398 100644 --- a/tests/format.test +++ b/tests/format.test @@ -564,9 +564,12 @@ test format-19.3 {Bug 2830354} { test format-20.1 {Bug 2932421: plain %s caused intrep change of args} -body { set x [dict create a b c d] format %s $x - # After this, obj in $x should be a dict with a non-NULL bytes field + # After this, obj in $x should be a dict + # We are testing to make sure it has not been shimmered to a + # different intrep when that is not necessary. + # Whether or not there is a string rep - we should not care! tcl::unsupported::representation $x -} -match glob -result {value is a dict with *, string representation "*"} +} -match glob -result {value is a dict *} # cleanup catch {unset a} diff --git a/tests/stringComp.test b/tests/stringComp.test index 77e14d6..3ce2b72 100644 --- a/tests/stringComp.test +++ b/tests/stringComp.test @@ -738,6 +738,9 @@ test stringComp-14.4 {Bug 1af8de570511} { string replace $val[unset val] 1 1 $y }} 4 x } 0x00 +test stringComp-14.5 {} { + string length [string replace [string repeat a\u00fe 2] 3 end {}] +} 3 ## string tolower ## not yet bc |
