summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2024-09-17 16:54:17 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2024-09-17 16:57:58 -0700
commit865b54e2acea4fdaa3f302ed225f50281b371d6e (patch)
treef79d93d16a410a3fb9ef42a61260561eb609978e /lib-src
parente0b027d1215ed32fe0f3d0956d2d7a81552274f2 (diff)
Use c-ctype.h in lib-src
This fixes some unlikely bugs and removes the temptation of using ctype.h. Although some uses were correct, many weren't. * lib-src/ebrowse.c: Include c-ctype.h, not ctype.h. * lib-src/emacsclient.c: Include c-ctype.h, not ctype.h. * lib-src/update-game-score.c: Include c-ctype.h, not ctype.h. All uses changed.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ebrowse.c10
-rw-r--r--lib-src/emacsclient.c6
-rw-r--r--lib-src/update-game-score.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 821c29272a4..13c1befdc3e 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -22,11 +22,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <assert.h>
#include <getopt.h>
#include <attribute.h>
+#include <c-ctype.h>
#include <flexmember.h>
#include <min-max.h>
#include <unlocked-io.h>
@@ -1875,7 +1875,7 @@ yylex (void)
int_suffixes:
/* Integer suffixes. */
- while (isalpha (c))
+ while (c_isalpha (c))
GET (c);
UNGET ();
return CINT;
@@ -1907,7 +1907,7 @@ yylex (void)
}
/* Optional type suffixes. */
- while (isalpha (c))
+ while (c_isalpha (c))
GET (c);
UNGET ();
return CFLOAT;
@@ -2158,7 +2158,7 @@ init_scanner (void)
/* Set up character class vectors. */
for (i = 0; i < sizeof is_ident; ++i)
{
- if (i == '_' || isalnum (i))
+ if (i == '_' || c_isalnum (i))
is_ident[i] = 1;
if (i >= '0' && i <= '9')
@@ -2946,7 +2946,7 @@ operator_name (int *sc)
MATCH ();
/* If this is a simple operator like `+', stop now. */
- if (!isalpha ((unsigned char) *s) && *s != '(' && *s != '[')
+ if (!c_isalpha (*s) && *s != '(' && *s != '[')
break;
++tokens_matched;
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 8e64f1e92d3..c1ffa1480ec 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -68,7 +68,6 @@ char *w32_getenv (const char *);
#define DEFAULT_TIMEOUT (30)
-#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
@@ -83,6 +82,7 @@ char *w32_getenv (const char *);
#include <unistd.h>
#include <attribute.h>
+#include <c-ctype.h>
#include <filename.h>
#include <intprops.h>
#include <min-max.h>
@@ -2124,7 +2124,7 @@ main (int argc, char **argv)
unsigned char c;
do
c = *++p;
- while (isdigit (c) || c == ':');
+ while (c_isdigit (c) || c == ':');
if (c == 0)
{
@@ -2136,7 +2136,7 @@ main (int argc, char **argv)
}
#ifdef WINDOWSNT
else if (! IS_ABSOLUTE_FILE_NAME (argv[i])
- && (isalpha (argv[i][0]) && argv[i][1] == ':'))
+ && (c_isalpha (argv[i][0]) && argv[i][1] == ':'))
/* Windows can have a different default directory for each
drive, so the cwd passed via "-dir" is not sufficient
to account for that.
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index e3b24ad7717..7545d0390c1 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -41,11 +41,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <time.h>
#include <pwd.h>
-#include <ctype.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <getopt.h>
+#include <c-ctype.h>
#include <unlocked-io.h>
#ifdef WINDOWSNT
@@ -143,7 +143,7 @@ normalize_integer (char *num)
{
bool neg;
char *p;
- while (*num != '\n' && isspace (*num))
+ while (*num != '\n' && c_isspace (*num))
num++;
neg = *num == '-';
num += neg || *num == '-';