summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 09:13:31 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-21 09:13:31 (GMT)
commitf87e7cdade0bf88329c0502b62047b06a645b264 (patch)
treedb3d92d7f56253982dc962f282e591a5cdb1d393 /generic
parent296aebbd6ee092a25741684fa37ee31ef5a3e222 (diff)
parentcd8d5b5a18221b00c35aa76c901a50d7fa45bef8 (diff)
downloadtcl-f87e7cdade0bf88329c0502b62047b06a645b264.zip
tcl-f87e7cdade0bf88329c0502b62047b06a645b264.tar.gz
tcl-f87e7cdade0bf88329c0502b62047b06a645b264.tar.bz2
Inline compat Tcl_GetDefaultEncodingDir.
Eliminate unnecessary static HasStubSupport() and isDigit() functions, just do the same inline.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclStubLib.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index a9d0f02..f61e0ca 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -23,28 +23,11 @@ const TclPlatStubs *tclPlatStubsPtr = NULL;
const TclIntStubs *tclIntStubsPtr = NULL;
const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
-static const TclStubs *
-HasStubSupport(
- Tcl_Interp *interp)
-{
- Interp *iPtr = (Interp *) interp;
-
- if (iPtr->stubTable && (iPtr->stubTable->magic == TCL_STUB_MAGIC)) {
- return iPtr->stubTable;
- }
- iPtr->result = (char *) "interpreter uses an incompatible stubs mechanism";
- iPtr->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)
/*
*----------------------------------------------------------------------
@@ -70,9 +53,10 @@ Tcl_InitStubs(
const char *version,
int exact)
{
+ Interp *iPtr = (Interp *) interp;
const char *actualVersion = NULL;
ClientData pkgData = NULL;
- const TclStubs *stubsPtr;
+ const TclStubs *stubsPtr = iPtr->stubTable;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -80,8 +64,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;
}
@@ -94,7 +79,7 @@ Tcl_InitStubs(
int count = 0;
while (*p) {
- count += !isDigit(*p++);
+ count += !ISDIGIT(*p++);
}
if (count == 1) {
const char *q = actualVersion;
@@ -103,7 +88,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;