summaryrefslogtreecommitdiffstats
path: root/generic/tclStubLib.c
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2012-12-23 08:17:17 (GMT)
committerdkf <dkf@noemail.net>2012-12-23 08:17:17 (GMT)
commitadb49f8d9cb277c29222dc26e59df034eeb97b58 (patch)
tree904a5c784012083beffa88301ce90c0d9ca69bc6 /generic/tclStubLib.c
parent4ab1d2e493eb5b58dc6d1029c72347e9e6f888cb (diff)
downloadtcl-adb49f8d9cb277c29222dc26e59df034eeb97b58.zip
tcl-adb49f8d9cb277c29222dc26e59df034eeb97b58.tar.gz
tcl-adb49f8d9cb277c29222dc26e59df034eeb97b58.tar.bz2
Change back to using an isDigit function. We simply don't need to make any
(formally non-portable) assumptions about what happens when an unsigned zero is decremented, and the code isn't in a performance-critical area. FossilOrigin-Name: 31e633f6adedccdba61daf85e35d1ecdd8e10a89
Diffstat (limited to 'generic/tclStubLib.c')
-rw-r--r--generic/tclStubLib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index f61e0ca..859cbf9 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -24,10 +24,13 @@ const TclIntStubs *tclIntStubsPtr = NULL;
const TclIntPlatStubs *tclIntPlatStubsPtr = NULL;
/*
- * Use our own ISDIGIT to avoid linking to libc on windows
+ * Use our own isDigit to avoid linking to libc on windows
*/
-#define ISDIGIT(c) (((unsigned)((c)-'0')) <= 9)
+static int isDigit(const int c)
+{
+ return (c >= '0' && c <= '9');
+}
/*
*----------------------------------------------------------------------
@@ -79,7 +82,7 @@ Tcl_InitStubs(
int count = 0;
while (*p) {
- count += !ISDIGIT(*p++);
+ count += !isDigit(*p++);
}
if (count == 1) {
const char *q = actualVersion;
@@ -88,7 +91,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;