summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-11-29 21:34:26 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-11-29 21:34:26 (GMT)
commite2bde4d007334476f45e57a87d273a4eca7e9aec (patch)
tree144e65aff5b1967d46a4bc9f738d8ea81b8cd931
parent8f18fa7c78d11dad67f038dcd834c40ecc572780 (diff)
parentb3f8bdaff2101f6b235b59ab3157f45d7cc314c3 (diff)
downloadtcl-e2bde4d007334476f45e57a87d273a4eca7e9aec.zip
tcl-e2bde4d007334476f45e57a87d273a4eca7e9aec.tar.gz
tcl-e2bde4d007334476f45e57a87d273a4eca7e9aec.tar.bz2
Merge 8.6
-rw-r--r--generic/tclEnsemble.c37
-rw-r--r--tests/event.test2
-rw-r--r--tests/timer.test4
3 files changed, 28 insertions, 15 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index b710399..a5fd715 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2079,8 +2079,8 @@ TclResetRewriteEnsemble(
*
* TclSpellFix --
*
- * Record a spelling correction that needs making in the
- * generation of the WrongNumArgs usage message.
+ * Record a spelling correction that needs making in the generation of
+ * the WrongNumArgs usage message.
*
* Results:
* None.
@@ -2097,9 +2097,10 @@ FreeER(
Tcl_Interp *interp,
int result)
{
- Tcl_Obj **tmp = (Tcl_Obj **)data[0];
+ Tcl_Obj **tmp = (Tcl_Obj **) data[0];
+ Tcl_Obj **store = (Tcl_Obj **) data[1];
- ckfree(tmp[2]);
+ ckfree(store);
ckfree(tmp);
return result;
}
@@ -2135,8 +2136,9 @@ TclSpellFix(
search = iPtr->ensembleRewrite.sourceObjs;
if (search[0] == NULL) {
/*
- * Awful casting abuse here...
+ * Awful casting abuse here!
*/
+
search = (Tcl_Obj *const *) search[1];
}
@@ -2157,7 +2159,10 @@ TclSpellFix(
return;
}
} else {
- /* Jump to the misspelled value. */
+ /*
+ * Jump to the misspelled value.
+ */
+
idx = iPtr->ensembleRewrite.numRemovedObjs + badIdx
- iPtr->ensembleRewrite.numInsertedObjs;
@@ -2170,17 +2175,25 @@ TclSpellFix(
search = iPtr->ensembleRewrite.sourceObjs;
if (search[0] == NULL) {
store = (Tcl_Obj **) search[2];
- } else {
+ } else {
Tcl_Obj **tmp = ckalloc(3 * sizeof(Tcl_Obj *));
+ store = ckalloc(size * sizeof(Tcl_Obj *));
+ memcpy(store, iPtr->ensembleRewrite.sourceObjs,
+ size * sizeof(Tcl_Obj *));
+
+ /*
+ * Awful casting abuse here! Note that the NULL in the first element
+ * indicates that the initial objects are a raw array in the second
+ * element and the rewritten ones are a raw array in the third.
+ */
+
tmp[0] = NULL;
tmp[1] = (Tcl_Obj *) iPtr->ensembleRewrite.sourceObjs;
- tmp[2] = (Tcl_Obj *) ckalloc(size * sizeof(Tcl_Obj *));
- memcpy(tmp[2], tmp[1], size * sizeof(Tcl_Obj *));
-
+ tmp[2] = (Tcl_Obj *) store;
iPtr->ensembleRewrite.sourceObjs = (Tcl_Obj *const *) tmp;
- TclNRAddCallback(interp, FreeER, tmp, NULL, NULL, NULL);
- store = (Tcl_Obj **)tmp[2];
+
+ TclNRAddCallback(interp, FreeER, tmp, store, NULL, NULL);
}
store[idx] = fix;
diff --git a/tests/event.test b/tests/event.test
index ef0947f..5c111f8 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -527,7 +527,7 @@ test event-11.4 {Tcl_VwaitCmd procedure} -setup {
} -body {
after 100 {set x x-done}
after 200 {set y y-done}
- after 300 {set z z-done}
+ after 400 {set z z-done}
after idle {set q q-done}
set x before
set y before
diff --git a/tests/timer.test b/tests/timer.test
index ab6efc9..740d05e 100644
--- a/tests/timer.test
+++ b/tests/timer.test
@@ -205,11 +205,11 @@ test timer-6.4 {Tcl_AfterCmd procedure, ms argument} {
} {before after}
test timer-6.5 {Tcl_AfterCmd procedure, ms argument} {
set x before
- after 300 set x after
+ after 400 set x after
after 200
update
set y $x
- after 200
+ after 400
update
list $y $x
} {before after}