summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-07-14 08:22:11 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-07-14 08:22:11 (GMT)
commit0e87dee6653b2bbae46ab63cf98efb4b06b7380c (patch)
tree79720d937b6a45b4d2198754f72cf26f406a40b6
parent8d88b8afd68de02f280b0221a74a1116bb4f06dd (diff)
downloadtcl-0e87dee6653b2bbae46ab63cf98efb4b06b7380c.zip
tcl-0e87dee6653b2bbae46ab63cf98efb4b06b7380c.tar.gz
tcl-0e87dee6653b2bbae46ab63cf98efb4b06b7380c.tar.bz2
Store ClientDatas in NRE callback storage as an array; that's how they are
referred to in callback implementations anyway.
-rw-r--r--ChangeLog22
-rw-r--r--generic/tclBasic.c14
-rw-r--r--generic/tclNRE.h7
-rw-r--r--generic/tclProc.c7
4 files changed, 28 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index f034a4e..837a169 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-07-14 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclProc.c (TclNRApplyObjCmd, TclObjInterpProcCore):
+ * generic/tclBasic.c (TclNR_AddCallback, TclEvalObjv_NR2):
+ * generic/tclNRE.h (TEOV_callback): Change the callback storage type
+ to use an array, so guaranteeing correct inter-member spacing and
+ memory layout.
+
2008-07-14 Miguel Sofer <msofer@users.sf.net>
* generic/tclExecute.c: Remove unneeded TclInterpReady calls
@@ -54,9 +62,9 @@
* tests/parse.test:
* tests/stack.test:
- * unix/configure: Removing support for the hacky nonportable stack
- * unix/configure.in: check: it is not needed anymore, Tcl is very
- * unix/tclConfig.h.in: thrifty on the C stack.
+ * unix/configure: Removing support for the hacky nonportable
+ * unix/configure.in: stack check: it is not needed anymore, Tcl
+ * unix/tclConfig.h.in: is very thrifty on the C stack.
* unix/tclUnixInit.c:
* unix/tclUnixTest.c:
* win/tclWin32Dll.c:
@@ -64,10 +72,10 @@
2008-07-08 Don Porter <dgp@users.sourceforge.net>
* generic/tclGet.c: Corrected out of date comments and removed
- * generic/tclInt.decls: internal routine TclGetLong() that's no longer
- used. If an extension is using this from the internal stubs table, it
- can shift to the public routine Tcl_GetLongFromObj() or can request
- addition of a public Tcl_GetLong().
+ * generic/tclInt.decls: internal routine TclGetLong() that's no
+ longer used. If an extension is using this from the internal stubs
+ table, it can shift to the public routine Tcl_GetLongFromObj() or
+ can request addition of a public Tcl_GetLong().
***POTENTIAL INCOMPATIBILITY***
* generic/tclIntDecls.h: make genstubs
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index e2d3712..273afea 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.309 2008/07/14 01:38:00 msofer Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.310 2008/07/14 08:22:13 dkf Exp $
*/
#include "tclInt.h"
@@ -4234,8 +4234,8 @@ int TclEvalObjv_NR2(
while (recordPtr->callbackPtr) {
TEOV_callback *callbackPtr = recordPtr->callbackPtr;
- result = (*callbackPtr->procPtr)(&callbackPtr->data0,
- interp, result);
+
+ result = callbackPtr->procPtr(callbackPtr->data, interp, result);
callbackPtr = callbackPtr->nextPtr;
TclSmallFree(recordPtr->callbackPtr);
recordPtr->callbackPtr = callbackPtr;
@@ -7674,10 +7674,10 @@ void TclNR_AddCallback(
TclSmallAlloc(sizeof(TEOV_callback), callbackPtr);
callbackPtr->procPtr = postProcPtr;
- callbackPtr->data0 = data0;
- callbackPtr->data1 = data1;
- callbackPtr->data2 = data2;
- callbackPtr->data3 = data3;
+ callbackPtr->data[0] = data0;
+ callbackPtr->data[1] = data1;
+ callbackPtr->data[2] = data2;
+ callbackPtr->data[3] = data3;
callbackPtr->nextPtr = recordPtr->callbackPtr;
recordPtr->callbackPtr = callbackPtr;
diff --git a/generic/tclNRE.h b/generic/tclNRE.h
index d892f61..729cf51 100644
--- a/generic/tclNRE.h
+++ b/generic/tclNRE.h
@@ -11,7 +11,7 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* // FIXME: RCS numbering?
- * RCS: @(#) $Id: tclNRE.h,v 1.1 2008/07/13 09:04:54 msofer Exp $
+ * RCS: @(#) $Id: tclNRE.h,v 1.2 2008/07/14 08:22:14 dkf Exp $
*/
@@ -90,10 +90,7 @@ struct ByteCode;
/* Fill up a SmallAlloc: 4 free ptrs for the user */
typedef struct TEOV_callback {
TclNR_PostProc *procPtr;
- ClientData data0;
- ClientData data1;
- ClientData data2;
- ClientData data3;
+ ClientData data[4];
struct TEOV_callback *nextPtr;
} TEOV_callback;
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 70f2921..4ecd57f 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.144 2008/07/14 00:11:33 msofer Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.145 2008/07/14 08:22:14 dkf Exp $
*/
#include "tclInt.h"
@@ -1735,7 +1735,7 @@ TclObjInterpProcCore(
if (result == TCL_OK) {
result = TclExecuteByteCode(interp, record.data.codePtr);
result = TclEvalObjv_NR2(interp, result, rootPtr);
- result = InterpProcNR2(&record.callbackPtr->data0, interp, result);
+ result = InterpProcNR2(record.callbackPtr->data, interp, result);
TclSmallFree(record.callbackPtr);
}
return result;
@@ -2816,8 +2816,9 @@ TclNRApplyObjCmd(
/* Fix the recordPtr! */
TEOV_record *recordPtr = TOP_RECORD(iPtr);
+
recordPtr->callbackPtr->procPtr = ApplyNR2;
- recordPtr->callbackPtr->data2 = extraPtr;
+ recordPtr->callbackPtr->data[2] = extraPtr;
}
}
if (result != TCL_OK) {