Skip to content

Commit

Permalink
isDigit -> ISDIGIT (simplification, backported from 8.7/9.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Jan 1, 2025
1 parent b5e13d0 commit 0824b9a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions generic/tclStubLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Stub object that will be statically linked into extensions that want
* to access Tcl.
*
* Copyright (c) 1998-1999 by Scriptics Corporation.
* Copyright (c) 1998-1999 Scriptics Corporation.
* Copyright (c) 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
Expand All @@ -24,13 +24,10 @@ 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
*/

static int isDigit(const int c)
{
return (c >= '0' && c <= '9');
}
#define ISDIGIT(c) (((unsigned)((c)-'0')) <= 9)

/*
*----------------------------------------------------------------------
Expand All @@ -56,9 +53,9 @@ Tcl_InitStubs(
const char *version,
int exact)
{
Interp *iPtr = (Interp *) interp;
Interp *iPtr = (Interp *)interp;
const char *actualVersion = NULL;
ClientData pkgData = NULL;
void *pkgData = NULL;
const TclStubs *stubsPtr = iPtr->stubTable;

/*
Expand All @@ -82,7 +79,7 @@ Tcl_InitStubs(
int count = 0;

while (*p) {
count += !isDigit(*p++);
count += !ISDIGIT(*p++);
}
if (count == 1) {
const char *q = actualVersion;
Expand All @@ -91,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;
Expand Down

0 comments on commit 0824b9a

Please sign in to comment.