summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclStubLib.c27
-rw-r--r--generic/tclStubLibTbl.c15
3 files changed, 27 insertions, 17 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 3432b37..c350d15 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -3837,7 +3837,7 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp,
/* Used internally in stub library. */
typedef struct {
char version[12];
- ClientData data;
+ const TclStubs *stubs;
} TclStubInfoType;
MODULE_SCOPE const char *TclInitStubTable(const char *version);
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index e617515..859cbf9 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -13,6 +13,16 @@
#include "tclInt.h"
+MODULE_SCOPE const TclStubs *tclStubsPtr;
+MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr;
+MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
+MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;
+
+const TclStubs *tclStubsPtr = NULL;
+const TclPlatStubs *tclPlatStubsPtr = NULL;
+const TclIntStubs *tclIntStubsPtr = NULL;
+const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
+
/*
* Use our own isDigit to avoid linking to libc on windows
*/
@@ -48,7 +58,7 @@ Tcl_InitStubs(
{
Interp *iPtr = (Interp *) interp;
const char *actualVersion = NULL;
- TclStubInfoType stub;
+ ClientData pkgData = NULL;
const TclStubs *stubsPtr = iPtr->stubTable;
/*
@@ -63,7 +73,7 @@ Tcl_InitStubs(
return NULL;
}
- actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &stub.data);
+ actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData);
if (actualVersion == NULL) {
return NULL;
}
@@ -93,7 +103,18 @@ Tcl_InitStubs(
}
}
}
- TclInitStubTable(stub.version);
+ tclStubsPtr = (TclStubs *)pkgData;
+
+ if (tclStubsPtr->hooks) {
+ tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
+ tclIntStubsPtr = tclStubsPtr->hooks->tclIntStubs;
+ tclIntPlatStubsPtr = tclStubsPtr->hooks->tclIntPlatStubs;
+ } else {
+ tclPlatStubsPtr = NULL;
+ tclIntStubsPtr = NULL;
+ tclIntPlatStubsPtr = NULL;
+ }
+
return actualVersion;
}
diff --git a/generic/tclStubLibTbl.c b/generic/tclStubLibTbl.c
index 0ed057f..0391502 100644
--- a/generic/tclStubLibTbl.c
+++ b/generic/tclStubLibTbl.c
@@ -13,17 +13,6 @@
#include "tclInt.h"
-MODULE_SCOPE const TclStubs *tclStubsPtr;
-MODULE_SCOPE const TclPlatStubs *tclPlatStubsPtr;
-MODULE_SCOPE const TclIntStubs *tclIntStubsPtr;
-MODULE_SCOPE const TclIntPlatStubs *tclIntPlatStubsPtr;
-
-const TclStubs *tclStubsPtr = NULL;
-const TclPlatStubs *tclPlatStubsPtr = NULL;
-const TclIntStubs *tclIntStubsPtr = NULL;
-const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-
-
/*
*----------------------------------------------------------------------
*
@@ -45,8 +34,7 @@ TclInitStubTable(
const char *version) /* points to the version field of a
TclStubInfoType structure variable. */
{
- const TclStubInfoType *ptr = (const TclStubInfoType *) version;
- tclStubsPtr = (const TclStubs *) ptr->data;
+ tclStubsPtr = ((const TclStubInfoType *) version)->stubs;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
@@ -57,6 +45,7 @@ TclInitStubTable(
tclIntStubsPtr = NULL;
tclIntPlatStubsPtr = NULL;
}
+
return version;
}