diff options
| author | Paul Eggert | 2024-09-17 16:54:17 -0700 |
|---|---|---|
| committer | Paul Eggert | 2024-09-17 16:57:58 -0700 |
| commit | 865b54e2acea4fdaa3f302ed225f50281b371d6e (patch) | |
| tree | f79d93d16a410a3fb9ef42a61260561eb609978e /lib-src | |
| parent | e0b027d1215ed32fe0f3d0956d2d7a81552274f2 (diff) | |
| download | emacs-865b54e2acea4fdaa3f302ed225f50281b371d6e.tar.gz emacs-865b54e2acea4fdaa3f302ed225f50281b371d6e.zip | |
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.c | 10 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 6 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 4 |
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/>. */ | |||
| 22 | #include <stddef.h> | 22 | #include <stddef.h> |
| 23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 24 | #include <string.h> | 24 | #include <string.h> |
| 25 | #include <ctype.h> | ||
| 26 | #include <assert.h> | 25 | #include <assert.h> |
| 27 | #include <getopt.h> | 26 | #include <getopt.h> |
| 28 | 27 | ||
| 29 | #include <attribute.h> | 28 | #include <attribute.h> |
| 29 | #include <c-ctype.h> | ||
| 30 | #include <flexmember.h> | 30 | #include <flexmember.h> |
| 31 | #include <min-max.h> | 31 | #include <min-max.h> |
| 32 | #include <unlocked-io.h> | 32 | #include <unlocked-io.h> |
| @@ -1875,7 +1875,7 @@ yylex (void) | |||
| 1875 | 1875 | ||
| 1876 | int_suffixes: | 1876 | int_suffixes: |
| 1877 | /* Integer suffixes. */ | 1877 | /* Integer suffixes. */ |
| 1878 | while (isalpha (c)) | 1878 | while (c_isalpha (c)) |
| 1879 | GET (c); | 1879 | GET (c); |
| 1880 | UNGET (); | 1880 | UNGET (); |
| 1881 | return CINT; | 1881 | return CINT; |
| @@ -1907,7 +1907,7 @@ yylex (void) | |||
| 1907 | } | 1907 | } |
| 1908 | 1908 | ||
| 1909 | /* Optional type suffixes. */ | 1909 | /* Optional type suffixes. */ |
| 1910 | while (isalpha (c)) | 1910 | while (c_isalpha (c)) |
| 1911 | GET (c); | 1911 | GET (c); |
| 1912 | UNGET (); | 1912 | UNGET (); |
| 1913 | return CFLOAT; | 1913 | return CFLOAT; |
| @@ -2158,7 +2158,7 @@ init_scanner (void) | |||
| 2158 | /* Set up character class vectors. */ | 2158 | /* Set up character class vectors. */ |
| 2159 | for (i = 0; i < sizeof is_ident; ++i) | 2159 | for (i = 0; i < sizeof is_ident; ++i) |
| 2160 | { | 2160 | { |
| 2161 | if (i == '_' || isalnum (i)) | 2161 | if (i == '_' || c_isalnum (i)) |
| 2162 | is_ident[i] = 1; | 2162 | is_ident[i] = 1; |
| 2163 | 2163 | ||
| 2164 | if (i >= '0' && i <= '9') | 2164 | if (i >= '0' && i <= '9') |
| @@ -2946,7 +2946,7 @@ operator_name (int *sc) | |||
| 2946 | MATCH (); | 2946 | MATCH (); |
| 2947 | 2947 | ||
| 2948 | /* If this is a simple operator like `+', stop now. */ | 2948 | /* If this is a simple operator like `+', stop now. */ |
| 2949 | if (!isalpha ((unsigned char) *s) && *s != '(' && *s != '[') | 2949 | if (!c_isalpha (*s) && *s != '(' && *s != '[') |
| 2950 | break; | 2950 | break; |
| 2951 | 2951 | ||
| 2952 | ++tokens_matched; | 2952 | ++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 *); | |||
| 68 | 68 | ||
| 69 | #define DEFAULT_TIMEOUT (30) | 69 | #define DEFAULT_TIMEOUT (30) |
| 70 | 70 | ||
| 71 | #include <ctype.h> | ||
| 72 | #include <errno.h> | 71 | #include <errno.h> |
| 73 | #include <getopt.h> | 72 | #include <getopt.h> |
| 74 | #include <inttypes.h> | 73 | #include <inttypes.h> |
| @@ -83,6 +82,7 @@ char *w32_getenv (const char *); | |||
| 83 | #include <unistd.h> | 82 | #include <unistd.h> |
| 84 | 83 | ||
| 85 | #include <attribute.h> | 84 | #include <attribute.h> |
| 85 | #include <c-ctype.h> | ||
| 86 | #include <filename.h> | 86 | #include <filename.h> |
| 87 | #include <intprops.h> | 87 | #include <intprops.h> |
| 88 | #include <min-max.h> | 88 | #include <min-max.h> |
| @@ -2124,7 +2124,7 @@ main (int argc, char **argv) | |||
| 2124 | unsigned char c; | 2124 | unsigned char c; |
| 2125 | do | 2125 | do |
| 2126 | c = *++p; | 2126 | c = *++p; |
| 2127 | while (isdigit (c) || c == ':'); | 2127 | while (c_isdigit (c) || c == ':'); |
| 2128 | 2128 | ||
| 2129 | if (c == 0) | 2129 | if (c == 0) |
| 2130 | { | 2130 | { |
| @@ -2136,7 +2136,7 @@ main (int argc, char **argv) | |||
| 2136 | } | 2136 | } |
| 2137 | #ifdef WINDOWSNT | 2137 | #ifdef WINDOWSNT |
| 2138 | else if (! IS_ABSOLUTE_FILE_NAME (argv[i]) | 2138 | else if (! IS_ABSOLUTE_FILE_NAME (argv[i]) |
| 2139 | && (isalpha (argv[i][0]) && argv[i][1] == ':')) | 2139 | && (c_isalpha (argv[i][0]) && argv[i][1] == ':')) |
| 2140 | /* Windows can have a different default directory for each | 2140 | /* Windows can have a different default directory for each |
| 2141 | drive, so the cwd passed via "-dir" is not sufficient | 2141 | drive, so the cwd passed via "-dir" is not sufficient |
| 2142 | to account for that. | 2142 | 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/>. */ | |||
| 41 | #include <stdlib.h> | 41 | #include <stdlib.h> |
| 42 | #include <time.h> | 42 | #include <time.h> |
| 43 | #include <pwd.h> | 43 | #include <pwd.h> |
| 44 | #include <ctype.h> | ||
| 45 | #include <fcntl.h> | 44 | #include <fcntl.h> |
| 46 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
| 47 | #include <getopt.h> | 46 | #include <getopt.h> |
| 48 | 47 | ||
| 48 | #include <c-ctype.h> | ||
| 49 | #include <unlocked-io.h> | 49 | #include <unlocked-io.h> |
| 50 | 50 | ||
| 51 | #ifdef WINDOWSNT | 51 | #ifdef WINDOWSNT |
| @@ -143,7 +143,7 @@ normalize_integer (char *num) | |||
| 143 | { | 143 | { |
| 144 | bool neg; | 144 | bool neg; |
| 145 | char *p; | 145 | char *p; |
| 146 | while (*num != '\n' && isspace (*num)) | 146 | while (*num != '\n' && c_isspace (*num)) |
| 147 | num++; | 147 | num++; |
| 148 | neg = *num == '-'; | 148 | neg = *num == '-'; |
| 149 | num += neg || *num == '-'; | 149 | num += neg || *num == '-'; |