summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 08:36:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 08:36:38 (GMT)
commitcd8d5b5a18221b00c35aa76c901a50d7fa45bef8 (patch)
tree42228049596798c62dd1b915c86720bd7bd11f4c
parentf0de1fd27c3a2f0e88e89b4ce85ec9a0c72508f6 (diff)
parentb59e26b4ebf4d75131241be768955f8ae29e498f (diff)
downloadtcl-cd8d5b5a18221b00c35aa76c901a50d7fa45bef8.zip
tcl-cd8d5b5a18221b00c35aa76c901a50d7fa45bef8.tar.gz
tcl-cd8d5b5a18221b00c35aa76c901a50d7fa45bef8.tar.bz2
Make pkgb.so loadable in Tcl 8.4 as well.
Eliminate unnessarcy static HasStubSupport() and isDigit() functions, just do the same inline.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclStubLib.c33
-rw-r--r--unix/dltest/pkgb.c18
3 files changed, 27 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index a9b9d57..147224d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-21 Jan Nijtmans <nijtmans@users.sf.net>
+
+ * unix/dltest/pkgb.c: Make pkgb.so loadable in Tcl 8.4 as well.
+ * generic/tclStubLib.c: Eliminate unnessarcy static HasStubSupport() and
+ isDigit() functions, just do the same inline.
+
2012-12-13 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tcl.h: Fix Tcl_DecrRefCount macro such that it
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index c98956e..31fc865 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -19,28 +19,11 @@ TclIntStubs *tclIntStubsPtr = NULL;
TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
TclTomMathStubs* tclTomMathStubsPtr = NULL;
-static TclStubs *
-HasStubSupport(
- 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(
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(
* 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(
int count = 0;
while (*p) {
- count += !isDigit(*p++);
+ count += !ISDIGIT(*p++);
}
if (count == 1) {
CONST char *q = actualVersion;
@@ -99,7 +84,7 @@ Tcl_InitStubs(
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;
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 489f66b..3338eb5 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -104,15 +104,18 @@ Pkgb_UnsafeObjCmd(
*----------------------------------------------------------------------
*/
-int
+DLLEXPORT int
Pkgb_Init(
Tcl_Interp *interp) /* Interpreter in which the package is to be
* made available. */
{
int code;
- if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) {
- return TCL_ERROR;
+ if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.4-", 0) == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_ResetResult(interp);
}
code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL);
if (code != TCL_OK) {
@@ -142,15 +145,18 @@ Pkgb_Init(
*----------------------------------------------------------------------
*/
-int
+DLLEXPORT int
Pkgb_SafeInit(
Tcl_Interp *interp) /* Interpreter in which the package is to be
* made available. */
{
int code;
- if (Tcl_InitStubs(interp, "8.5-9.1", 0) == NULL) {
- return TCL_ERROR;
+ if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
+ if (Tcl_InitStubs(interp, "8.4-", 0) == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_ResetResult(interp);
}
code = Tcl_PkgProvideEx(interp, "Pkgb", "2.3", NULL);
if (code != TCL_OK) {