summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-07 21:30:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-07 21:30:31 (GMT)
commitb2ff7f2e251e1bf049254d4db77ed648299d9012 (patch)
treec9fd1d8a35f6f424ba73822f0f43eb5544a1e67d /generic
parent6d6c732492789c16c16f822a7b3ae1421261b86d (diff)
parente76d16d3eba7f034fc003f1061736c298b03c74f (diff)
downloadtcl-b2ff7f2e251e1bf049254d4db77ed648299d9012.zip
tcl-b2ff7f2e251e1bf049254d4db77ed648299d9012.tar.gz
tcl-b2ff7f2e251e1bf049254d4db77ed648299d9012.tar.bz2
only set tclStubsPtr when all version checks pass
Diffstat (limited to 'generic')
-rw-r--r--generic/tclStubLib.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 9774731..ff899c0 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -11,24 +11,8 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-/*
- * We need to ensure that we use the stub macros so that this file contains no
- * references to any of the stub functions. This will make it possible to
- * build an extension that references Tcl_InitStubs but doesn't end up
- * including the rest of the stub functions.
- */
-
-#ifndef USE_TCL_STUBS
-#define USE_TCL_STUBS
-#endif
-#undef USE_TCL_STUB_PROCS
-
#include "tclInt.h"
-/*
- * Tcl_InitStubs and stub table pointers are built as exported symbols.
- */
-
TclStubs *tclStubsPtr = NULL;
TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
@@ -75,11 +59,7 @@ static int isDigit(const int c)
*
*----------------------------------------------------------------------
*/
-
-#ifdef Tcl_InitStubs
#undef Tcl_InitStubs
-#endif
-
CONST char *
Tcl_InitStubs(
Tcl_Interp *interp,
@@ -87,7 +67,7 @@ Tcl_InitStubs(
int exact)
{
CONST char *actualVersion = NULL;
- ClientData pkgData = NULL;
+ TclStubs *stubsPtr;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -95,12 +75,12 @@ Tcl_InitStubs(
* times. [Bug 615304]
*/
- tclStubsPtr = HasStubSupport(interp);
- if (!tclStubsPtr) {
+ stubsPtr = HasStubSupport(interp);
+ if (!stubsPtr) {
return NULL;
}
- actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData);
+ actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 0, NULL);
if (actualVersion == NULL) {
return NULL;
}
@@ -120,17 +100,17 @@ Tcl_InitStubs(
}
if (*p || isDigit(*q)) {
/* Construct error message */
- Tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
+ stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
return NULL;
}
} else {
- actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
+ actualVersion = stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
if (actualVersion == NULL) {
return NULL;
}
}
}
- tclStubsPtr = (TclStubs*)pkgData;
+ tclStubsPtr = stubsPtr;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
@@ -162,9 +142,7 @@ Tcl_InitStubs(
*----------------------------------------------------------------------
*/
-#ifdef TclTomMathInitializeStubs
#undef TclTomMathInitializeStubs
-#endif
CONST char*
TclTomMathInitializeStubs(
@@ -179,7 +157,7 @@ TclTomMathInitializeStubs(
const char* errMsg = NULL;
ClientData pkgClientData = NULL;
const char* actualVersion =
- Tcl_PkgRequireEx(interp, packageName, version, exact, &pkgClientData);
+ tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, exact, &pkgClientData);
TclTomMathStubs* stubsPtr = (TclTomMathStubs*) pkgClientData;
if (actualVersion == NULL) {
return NULL;
@@ -194,10 +172,18 @@ TclTomMathInitializeStubs(
tclTomMathStubsPtr = stubsPtr;
return actualVersion;
}
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "error loading ", packageName,
+ tclStubsPtr->tcl_ResetResult(interp);
+ tclStubsPtr->tcl_AppendResult(interp, "error loading ", packageName,
" (requested version ", version,
", actual version ", actualVersion,
"): ", errMsg, NULL);
return NULL;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */