summaryrefslogtreecommitdiffstats
path: root/generic/tclStubLib.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 08:16:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 08:16:50 (GMT)
commitb59e26b4ebf4d75131241be768955f8ae29e498f (patch)
treec7ada10ae9e102a96ba6c49a5c31fbdefec55c8e /generic/tclStubLib.c
parent990ca78bafc3a3a4363dbdaca20c2c3f78b8ee83 (diff)
downloadtcl-b59e26b4ebf4d75131241be768955f8ae29e498f.zip
tcl-b59e26b4ebf4d75131241be768955f8ae29e498f.tar.gz
tcl-b59e26b4ebf4d75131241be768955f8ae29e498f.tar.bz2
Turn pkgb.so into a Tcl9 interoperability test library: Whatever Tcl9 looks like, loading pkgb.so in Tcl 9 should either result in an error-message, either succeed, but never crash.
Eliminate unnessarcy static HasStubSupport() and isDigit() functions, just do the same inline.
Diffstat (limited to 'generic/tclStubLib.c')
-rw-r--r--generic/tclStubLib.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index ceee8f3..7b62f5e 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -19,28 +19,11 @@ TclPlatStubs *tclPlatStubsPtr = NULL;
TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-static TclStubs *
-HasStubSupport(interp)
- Tcl_Interp *interp;
-{
- Interp *iPtr = (Interp *) interp;
-
- if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
- return iPtr->stubTable;
- }
- interp->result = "interpreter uses an incompatible stubs mechanism";
- interp->freeProc = TCL_STATIC;
- return NULL;
-}
-
/*
- * Use our own isdigit to avoid linking to libc on windows
+ * Use our own ISDIGIT to avoid linking to libc on windows
*/
-static int isDigit(const int c)
-{
- return (c >= '0' && c <= '9');
-}
+#define ISDIGIT(c) (((unsigned)((c)-'0')) <= 9)
/*
*----------------------------------------------------------------------
@@ -66,9 +49,10 @@ Tcl_InitStubs(interp, version, exact)
CONST char *version;
int exact;
{
+ Interp *iPtr = (Interp *) interp;
CONST char *actualVersion = NULL;
ClientData pkgData = NULL;
- TclStubs *stubsPtr;
+ TclStubs *stubsPtr = iPtr->stubTable;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -76,8 +60,9 @@ Tcl_InitStubs(interp, version, exact)
* times. [Bug 615304]
*/
- stubsPtr = HasStubSupport(interp);
- if (!stubsPtr) {
+ if (!stubsPtr || (stubsPtr->magic != TCL_STUB_MAGIC)) {
+ iPtr->result = "interpreter uses an incompatible stubs mechanism";
+ iPtr->freeProc = TCL_STATIC;
return NULL;
}
@@ -90,7 +75,7 @@ Tcl_InitStubs(interp, version, exact)
int count = 0;
while (*p) {
- count += !isDigit(*p++);
+ count += !ISDIGIT(*p++);
}
if (count == 1) {
CONST char *q = actualVersion;
@@ -99,7 +84,7 @@ Tcl_InitStubs(interp, version, exact)
while (*p && (*p == *q)) {
p++; q++;
}
- if (*p || isDigit(*q)) {
+ if (*p || ISDIGIT(*q)) {
/* Construct error message */
stubsPtr->tcl_PkgRequireEx(interp, "Tcl", version, 1, NULL);
return NULL;