diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-12-21 08:36:38 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2012-12-21 08:36:38 (GMT) |
commit | e683e9ff561d80e3e319f1d90b297e4de9670d12 (patch) | |
tree | 42228049596798c62dd1b915c86720bd7bd11f4c /generic/tclStubLib.c | |
parent | e086d8fd57a620bf31d497d956194c467d9d12cf (diff) | |
parent | cf7b247fb99734c43793cdd3ff6c6009acf0ba88 (diff) | |
download | tcl-e683e9ff561d80e3e319f1d90b297e4de9670d12.zip tcl-e683e9ff561d80e3e319f1d90b297e4de9670d12.tar.gz tcl-e683e9ff561d80e3e319f1d90b297e4de9670d12.tar.bz2 |
Make pkgb.so loadable in Tcl 8.4 as well.
Eliminate unnessarcy static HasStubSupport() and isDigit() functions, just do the same inline.
FossilOrigin-Name: 4355f3d4c8461f0be579417753cd8e41d35b003a
Diffstat (limited to 'generic/tclStubLib.c')
-rw-r--r-- | generic/tclStubLib.c | 33 |
1 files changed, 9 insertions, 24 deletions
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; |