aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-16 14:58:44 -0700
committerPaul Eggert2012-08-16 14:58:44 -0700
commit620f13b0612810324592ab2d2b4e5a5dab27f981 (patch)
tree844d21f0c90ede1887eb699058398f5f9a81f069 /src
parent85c2386bbe5d7957cf5750b6f96b2868f83eedf4 (diff)
downloademacs-620f13b0612810324592ab2d2b4e5a5dab27f981.tar.gz
emacs-620f13b0612810324592ab2d2b4e5a5dab27f981.zip
Use ASCII tests for character types.
* admin/merge-gnulib (GNULIB_MODULES): Add c-ctype. * lwlib/lwlib-Xaw.c, lwlib/lwlib.c, lwlib/xlwmenu.c: Don't include <ctype.h>; no longer needed. * lwlib/lwlib-Xaw.c (openFont): * lwlib/xlwmenu.c (openXftFont): Test just for ASCII digits. * src/category.c, src/dispnew.c, src/doprnt.c, src/editfns.c, src/syntax.c * src/term.c, src/xfns.c, src/xterm.c: Don't include <ctype.h>; was not needed. * src/charset.c, src/doc.c, src/fileio.c, src/font.c, src/frame.c: * src/gtkutil.c, src/image.c, src/sysdep.c, src/xfaces.c: Include <c-ctype.h> instead of <ctype.h>. * src/nsterm.m: Include <c-ctype.h>. * src/charset.c (read_hex): * src/doc.c (Fsnarf_documentation): * src/fileio.c (IS_DRIVE) [WINDOWSNT]: (DRIVE_LETTER) [DOS_NT]: (Ffile_name_directory, Fexpand_file_name) (Fsubstitute_in_file_name): * src/font.c (font_parse_xlfd, font_parse_fcname): * src/frame.c (x_set_font_backend): * src/gtkutil.c (xg_get_font): * src/image.c (xbm_scan, xpm_scan, pbm_scan_number): * src/nsimage.m (hexchar): * src/nsterm.m (ns_xlfd_to_fontname): * src/sysdep.c (system_process_attributes): * src/xfaces.c (hash_string_case_insensitive): Use C-locale tests instead of locale-specific tests for character types, since we want the ASCII interpretation here, not the interpretation suitable for whatever happens to be the current locale.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog28
-rw-r--r--src/category.c1
-rw-r--r--src/charset.c4
-rw-r--r--src/dispnew.c1
-rw-r--r--src/doc.c7
-rw-r--r--src/doprnt.c1
-rw-r--r--src/editfns.c1
-rw-r--r--src/fileio.c17
-rw-r--r--src/font.c9
-rw-r--r--src/frame.c8
-rw-r--r--src/gtkutil.c6
-rw-r--r--src/image.c34
-rw-r--r--src/nsimage.m3
-rw-r--r--src/nsterm.m8
-rw-r--r--src/syntax.c1
-rw-r--r--src/sysdep.c6
-rw-r--r--src/term.c1
-rw-r--r--src/xfaces.c4
-rw-r--r--src/xfns.c1
-rw-r--r--src/xterm.c1
20 files changed, 86 insertions, 56 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 95140401eb2..874088bb782 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,31 @@
12012-08-16 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use ASCII tests for character types.
4 * category.c, dispnew.c, doprnt.c, editfns.c, syntax.c, term.c:
5 * xfns.c, xterm.c:
6 Don't include <ctype.h>; was not needed.
7 * charset.c, doc.c, fileio.c, font.c, frame.c, gtkutil.c, image.c:
8 * sysdep.c, xfaces.c:
9 Include <c-ctype.h> instead of <ctype.h>.
10 * nsterm.m: Include <c-ctype.h>.
11 * charset.c (read_hex):
12 * doc.c (Fsnarf_documentation):
13 * fileio.c (IS_DRIVE) [WINDOWSNT]:
14 (DRIVE_LETTER) [DOS_NT]:
15 (Ffile_name_directory, Fexpand_file_name)
16 (Fsubstitute_in_file_name):
17 * font.c (font_parse_xlfd, font_parse_fcname):
18 * frame.c (x_set_font_backend):
19 * gtkutil.c (xg_get_font):
20 * image.c (xbm_scan, xpm_scan, pbm_scan_number):
21 * nsimage.m (hexchar):
22 * nsterm.m (ns_xlfd_to_fontname):
23 * sysdep.c (system_process_attributes):
24 * xfaces.c (hash_string_case_insensitive):
25 Use C-locale tests instead of locale-specific tests for character
26 types, since we want the ASCII interpretation here, not the
27 interpretation suitable for whatever happens to be the current locale.
28
12012-08-16 Martin Rudalics <rudalics@gmx.at> 292012-08-16 Martin Rudalics <rudalics@gmx.at>
2 30
3 Consistently check windows for validity/liveness 31 Consistently check windows for validity/liveness
diff --git a/src/category.c b/src/category.c
index 3d5b3cff04a..246a7d35a6d 100644
--- a/src/category.c
+++ b/src/category.c
@@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32 32
33#define CATEGORY_INLINE EXTERN_INLINE 33#define CATEGORY_INLINE EXTERN_INLINE
34 34
35#include <ctype.h>
36#include <setjmp.h> 35#include <setjmp.h>
37#include "lisp.h" 36#include "lisp.h"
38#include "character.h" 37#include "character.h"
diff --git a/src/charset.c b/src/charset.c
index fbbcefc4915..87c16e12008 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -30,10 +30,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30 30
31#include <stdio.h> 31#include <stdio.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <ctype.h>
34#include <limits.h> 33#include <limits.h>
35#include <sys/types.h> 34#include <sys/types.h>
36#include <setjmp.h> 35#include <setjmp.h>
36#include <c-ctype.h>
37#include "lisp.h" 37#include "lisp.h"
38#include "character.h" 38#include "character.h"
39#include "charset.h" 39#include "charset.h"
@@ -446,7 +446,7 @@ read_hex (FILE *fp, int *eof, int *overflow)
446 return 0; 446 return 0;
447 } 447 }
448 n = 0; 448 n = 0;
449 while (isxdigit (c = getc (fp))) 449 while (c_isxdigit (c = getc (fp)))
450 { 450 {
451 if (UINT_MAX >> 4 < n) 451 if (UINT_MAX >> 4 < n)
452 *overflow = 1; 452 *overflow = 1;
diff --git a/src/dispnew.c b/src/dispnew.c
index b82761f8cad..3288faba61b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23 23
24#include <signal.h> 24#include <signal.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <ctype.h>
27#include <setjmp.h> 26#include <setjmp.h>
28#include <unistd.h> 27#include <unistd.h>
29 28
diff --git a/src/doc.c b/src/doc.c
index d17e90f11c0..ed311d918d7 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -22,11 +22,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include <sys/types.h> 23#include <sys/types.h>
24#include <sys/file.h> /* Must be after sys/types.h for USG*/ 24#include <sys/file.h> /* Must be after sys/types.h for USG*/
25#include <ctype.h>
26#include <setjmp.h> 25#include <setjmp.h>
27#include <fcntl.h> 26#include <fcntl.h>
28#include <unistd.h> 27#include <unistd.h>
29 28
29#include <c-ctype.h>
30
30#include "lisp.h" 31#include "lisp.h"
31#include "character.h" 32#include "character.h"
32#include "buffer.h" 33#include "buffer.h"
@@ -597,9 +598,9 @@ the same file name is found in the `doc-directory'. */)
597 { 598 {
598 ptrdiff_t len; 599 ptrdiff_t len;
599 600
600 while (*beg && isspace (*beg)) ++beg; 601 while (*beg && c_isspace (*beg)) ++beg;
601 602
602 for (end = beg; *end && ! isspace (*end); ++end) 603 for (end = beg; *end && ! c_isspace (*end); ++end)
603 if (*end == '/') beg = end+1; /* skip directory part */ 604 if (*end == '/') beg = end+1; /* skip directory part */
604 605
605 len = end - beg; 606 len = end - beg;
diff --git a/src/doprnt.c b/src/doprnt.c
index 63f05cb74e2..b36e946005d 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -102,7 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102 102
103#include <config.h> 103#include <config.h>
104#include <stdio.h> 104#include <stdio.h>
105#include <ctype.h>
106#include <setjmp.h> 105#include <setjmp.h>
107#include <float.h> 106#include <float.h>
108#include <unistd.h> 107#include <unistd.h>
diff --git a/src/editfns.c b/src/editfns.c
index 5ac012c8378..b7feb733782 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -44,7 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#include <sys/resource.h> 44#include <sys/resource.h>
45#endif 45#endif
46 46
47#include <ctype.h>
48#include <float.h> 47#include <float.h>
49#include <limits.h> 48#include <limits.h>
50#include <intprops.h> 49#include <intprops.h>
diff --git a/src/fileio.c b/src/fileio.c
index eba157ea042..5991a238ffc 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include <pwd.h> 30#include <pwd.h>
31#endif 31#endif
32 32
33#include <ctype.h>
34#include <errno.h> 33#include <errno.h>
35 34
36#ifdef HAVE_LIBSELINUX 35#ifdef HAVE_LIBSELINUX
@@ -38,6 +37,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#include <selinux/context.h> 37#include <selinux/context.h>
39#endif 38#endif
40 39
40#include <c-ctype.h>
41
41#include "lisp.h" 42#include "lisp.h"
42#include "intervals.h" 43#include "intervals.h"
43#include "character.h" 44#include "character.h"
@@ -67,12 +68,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
67#define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') 68#define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z')
68#endif 69#endif
69#ifdef WINDOWSNT 70#ifdef WINDOWSNT
70#define IS_DRIVE(x) isalpha ((unsigned char) (x)) 71#define IS_DRIVE(x) c_isalpha (x)
71#endif 72#endif
72/* Need to lower-case the drive letter, or else expanded 73/* Need to lower-case the drive letter, or else expanded
73 filenames will sometimes compare unequal, because 74 filenames will sometimes compare unequal, because
74 `expand-file-name' doesn't always down-case the drive letter. */ 75 `expand-file-name' doesn't always down-case the drive letter. */
75#define DRIVE_LETTER(x) (tolower ((unsigned char) (x))) 76#define DRIVE_LETTER(x) c_tolower (x)
76#endif 77#endif
77 78
78#include "systime.h" 79#include "systime.h"
@@ -364,7 +365,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
364 r += 2; 365 r += 2;
365 } 366 }
366 367
367 if (getdefdir (toupper ((unsigned char) *beg) - 'A' + 1, r)) 368 if (getdefdir (c_toupper (*beg) - 'A' + 1, r))
368 { 369 {
369 if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) 370 if (!IS_DIRECTORY_SEP (res[strlen (res) - 1]))
370 strcat (res, "/"); 371 strcat (res, "/");
@@ -1053,7 +1054,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1053 if (!IS_DIRECTORY_SEP (nm[0])) 1054 if (!IS_DIRECTORY_SEP (nm[0]))
1054 { 1055 {
1055 adir = alloca (MAXPATHLEN + 1); 1056 adir = alloca (MAXPATHLEN + 1);
1056 if (!getdefdir (toupper (drive) - 'A' + 1, adir)) 1057 if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
1057 adir = NULL; 1058 adir = NULL;
1058 } 1059 }
1059 if (!adir) 1060 if (!adir)
@@ -1129,7 +1130,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1129 adir = alloca (MAXPATHLEN + 1); 1130 adir = alloca (MAXPATHLEN + 1);
1130 if (drive) 1131 if (drive)
1131 { 1132 {
1132 if (!getdefdir (toupper (drive) - 'A' + 1, adir)) 1133 if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
1133 newdir = "/"; 1134 newdir = "/";
1134 } 1135 }
1135 else 1136 else
@@ -1635,7 +1636,7 @@ those `/' is discarded. */)
1635 else 1636 else
1636 { 1637 {
1637 o = p; 1638 o = p;
1638 while (p != endp && (isalnum (*p) || *p == '_')) p++; 1639 while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
1639 s = p; 1640 s = p;
1640 } 1641 }
1641 1642
@@ -1698,7 +1699,7 @@ those `/' is discarded. */)
1698 else 1699 else
1699 { 1700 {
1700 o = p; 1701 o = p;
1701 while (p != endp && (isalnum (*p) || *p == '_')) p++; 1702 while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
1702 s = p; 1703 s = p;
1703 } 1704 }
1704 1705
diff --git a/src/font.c b/src/font.c
index c3040b8aa3f..5b9e4f1cfcf 100644
--- a/src/font.c
+++ b/src/font.c
@@ -23,9 +23,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <float.h> 24#include <float.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <ctype.h>
27#include <setjmp.h> 26#include <setjmp.h>
28 27
28#include <c-ctype.h>
29
29#include "lisp.h" 30#include "lisp.h"
30#include "character.h" 31#include "character.h"
31#include "buffer.h" 32#include "buffer.h"
@@ -1079,7 +1080,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
1079 p = f[XLFD_POINT_INDEX]; 1080 p = f[XLFD_POINT_INDEX];
1080 if (*p == '[') 1081 if (*p == '[')
1081 point_size = parse_matrix (p); 1082 point_size = parse_matrix (p);
1082 else if (isdigit (*p)) 1083 else if (c_isdigit (*p))
1083 point_size = atoi (p), point_size /= 10; 1084 point_size = atoi (p), point_size /= 10;
1084 if (point_size >= 0) 1085 if (point_size >= 0)
1085 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); 1086 ASET (font, FONT_SIZE_INDEX, make_float (point_size));
@@ -1346,7 +1347,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
1346 { 1347 {
1347 int decimal = 0, size_found = 1; 1348 int decimal = 0, size_found = 1;
1348 for (q = p + 1; *q && *q != ':'; q++) 1349 for (q = p + 1; *q && *q != ':'; q++)
1349 if (! isdigit (*q)) 1350 if (! c_isdigit (*q))
1350 { 1351 {
1351 if (*q != '.' || decimal) 1352 if (*q != '.' || decimal)
1352 { 1353 {
@@ -1474,7 +1475,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
1474 1475
1475 /* Scan backwards from the end, looking for a size. */ 1476 /* Scan backwards from the end, looking for a size. */
1476 for (p = name + len - 1; p >= name; p--) 1477 for (p = name + len - 1; p >= name; p--)
1477 if (!isdigit (*p)) 1478 if (!c_isdigit (*p))
1478 break; 1479 break;
1479 1480
1480 if ((p < name + len - 1) && ((p + 1 == name) || *p == ' ')) 1481 if ((p < name + len - 1) && ((p + 1 == name) || *p == ' '))
diff --git a/src/frame.c b/src/frame.c
index ea682835a87..9dabae55abc 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -20,10 +20,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21 21
22#include <stdio.h> 22#include <stdio.h>
23#include <ctype.h>
24#include <errno.h> 23#include <errno.h>
25#include <limits.h> 24#include <limits.h>
26#include <setjmp.h> 25#include <setjmp.h>
26
27#include <c-ctype.h>
28
27#include "lisp.h" 29#include "lisp.h"
28#include "character.h" 30#include "character.h"
29#ifdef HAVE_X_WINDOWS 31#ifdef HAVE_X_WINDOWS
@@ -3271,7 +3273,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3271 new_value = Qnil; 3273 new_value = Qnil;
3272 while (*p0) 3274 while (*p0)
3273 { 3275 {
3274 while (*p1 && ! isspace (*p1) && *p1 != ',') p1++; 3276 while (*p1 && ! c_isspace (*p1) && *p1 != ',') p1++;
3275 if (p0 < p1) 3277 if (p0 < p1)
3276 new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil), 3278 new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil),
3277 new_value); 3279 new_value);
@@ -3279,7 +3281,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3279 { 3281 {
3280 int c; 3282 int c;
3281 3283
3282 while ((c = *++p1) && isspace (c)); 3284 while ((c = *++p1) && c_isspace (c));
3283 } 3285 }
3284 p0 = p1; 3286 p0 = p1;
3285 } 3287 }
diff --git a/src/gtkutil.c b/src/gtkutil.c
index a4de47f073c..2941605d448 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -24,7 +24,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#include <signal.h> 24#include <signal.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <setjmp.h> 26#include <setjmp.h>
27#include <ctype.h> 27
28#include <c-ctype.h>
29
28#include "lisp.h" 30#include "lisp.h"
29#include "xterm.h" 31#include "xterm.h"
30#include "blockinput.h" 32#include "blockinput.h"
@@ -2072,7 +2074,7 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2072 if (p) 2074 if (p)
2073 { 2075 {
2074 char *ep = p+1; 2076 char *ep = p+1;
2075 while (isdigit (*ep)) 2077 while (c_isdigit (*ep))
2076 ++ep; 2078 ++ep;
2077 if (*ep == '\0') *p = ' '; 2079 if (*ep == '\0') *p = ' ';
2078 } 2080 }
diff --git a/src/image.c b/src/image.c
index 8a318c2f6ec..f2778165ece 100644
--- a/src/image.c
+++ b/src/image.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21#include <stdio.h> 21#include <stdio.h>
22#include <math.h> 22#include <math.h>
23#include <ctype.h>
24#include <unistd.h> 23#include <unistd.h>
25 24
26#ifdef HAVE_PNG 25#ifdef HAVE_PNG
@@ -33,6 +32,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33 32
34#include <setjmp.h> 33#include <setjmp.h>
35 34
35#include <c-ctype.h>
36
36/* This makes the fields of a Display accessible, in Xlib header files. */ 37/* This makes the fields of a Display accessible, in Xlib header files. */
37 38
38#define XLIB_ILLEGAL_ACCESS 39#define XLIB_ILLEGAL_ACCESS
@@ -2405,12 +2406,12 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2405 loop: 2406 loop:
2406 2407
2407 /* Skip white space. */ 2408 /* Skip white space. */
2408 while (*s < end && (c = *(*s)++, isspace (c))) 2409 while (*s < end && (c = *(*s)++, c_isspace (c)))
2409 ; 2410 ;
2410 2411
2411 if (*s >= end) 2412 if (*s >= end)
2412 c = 0; 2413 c = 0;
2413 else if (isdigit (c)) 2414 else if (c_isdigit (c))
2414 { 2415 {
2415 int value = 0, digit; 2416 int value = 0, digit;
2416 2417
@@ -2422,7 +2423,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2422 while (*s < end) 2423 while (*s < end)
2423 { 2424 {
2424 c = *(*s)++; 2425 c = *(*s)++;
2425 if (isdigit (c)) 2426 if (c_isdigit (c))
2426 digit = c - '0'; 2427 digit = c - '0';
2427 else if (c >= 'a' && c <= 'f') 2428 else if (c >= 'a' && c <= 'f')
2428 digit = c - 'a' + 10; 2429 digit = c - 'a' + 10;
@@ -2433,11 +2434,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2433 value = 16 * value + digit; 2434 value = 16 * value + digit;
2434 } 2435 }
2435 } 2436 }
2436 else if (isdigit (c)) 2437 else if (c_isdigit (c))
2437 { 2438 {
2438 value = c - '0'; 2439 value = c - '0';
2439 while (*s < end 2440 while (*s < end
2440 && (c = *(*s)++, isdigit (c))) 2441 && (c = *(*s)++, c_isdigit (c)))
2441 value = 8 * value + c - '0'; 2442 value = 8 * value + c - '0';
2442 } 2443 }
2443 } 2444 }
@@ -2445,7 +2446,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2445 { 2446 {
2446 value = c - '0'; 2447 value = c - '0';
2447 while (*s < end 2448 while (*s < end
2448 && (c = *(*s)++, isdigit (c))) 2449 && (c = *(*s)++, c_isdigit (c)))
2449 value = 10 * value + c - '0'; 2450 value = 10 * value + c - '0';
2450 } 2451 }
2451 2452
@@ -2454,11 +2455,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2454 *ival = value; 2455 *ival = value;
2455 c = XBM_TK_NUMBER; 2456 c = XBM_TK_NUMBER;
2456 } 2457 }
2457 else if (isalpha (c) || c == '_') 2458 else if (c_isalpha (c) || c == '_')
2458 { 2459 {
2459 *sval++ = c; 2460 *sval++ = c;
2460 while (*s < end 2461 while (*s < end
2461 && (c = *(*s)++, (isalnum (c) || c == '_'))) 2462 && (c = *(*s)++, (c_isalnum (c) || c == '_')))
2462 *sval++ = c; 2463 *sval++ = c;
2463 *sval = 0; 2464 *sval = 0;
2464 if (*s < end) 2465 if (*s < end)
@@ -3661,16 +3662,17 @@ xpm_scan (const unsigned char **s,
3661 while (*s < end) 3662 while (*s < end)
3662 { 3663 {
3663 /* Skip white-space. */ 3664 /* Skip white-space. */
3664 while (*s < end && (c = *(*s)++, isspace (c))) 3665 while (*s < end && (c = *(*s)++, c_isspace (c)))
3665 ; 3666 ;
3666 3667
3667 /* gnus-pointer.xpm uses '-' in its identifier. 3668 /* gnus-pointer.xpm uses '-' in its identifier.
3668 sb-dir-plus.xpm uses '+' in its identifier. */ 3669 sb-dir-plus.xpm uses '+' in its identifier. */
3669 if (isalpha (c) || c == '_' || c == '-' || c == '+') 3670 if (c_isalpha (c) || c == '_' || c == '-' || c == '+')
3670 { 3671 {
3671 *beg = *s - 1; 3672 *beg = *s - 1;
3672 while (*s < end 3673 while (*s < end
3673 && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) 3674 && (c = **s, c_isalnum (c)
3675 || c == '_' || c == '-' || c == '+'))
3674 ++*s; 3676 ++*s;
3675 *len = *s - *beg; 3677 *len = *s - *beg;
3676 return XPM_TK_IDENT; 3678 return XPM_TK_IDENT;
@@ -5014,7 +5016,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5014 while (*s < end) 5016 while (*s < end)
5015 { 5017 {
5016 /* Skip white-space. */ 5018 /* Skip white-space. */
5017 while (*s < end && (c = *(*s)++, isspace (c))) 5019 while (*s < end && (c = *(*s)++, c_isspace (c)))
5018 ; 5020 ;
5019 5021
5020 if (c == '#') 5022 if (c == '#')
@@ -5023,11 +5025,11 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
5023 while (*s < end && (c = *(*s)++, c != '\n')) 5025 while (*s < end && (c = *(*s)++, c != '\n'))
5024 ; 5026 ;
5025 } 5027 }
5026 else if (isdigit (c)) 5028 else if (c_isdigit (c))
5027 { 5029 {
5028 /* Read decimal number. */ 5030 /* Read decimal number. */
5029 val = c - '0'; 5031 val = c - '0';
5030 while (*s < end && (c = *(*s)++, isdigit (c))) 5032 while (*s < end && (c = *(*s)++, c_isdigit (c)))
5031 val = 10 * val + c - '0'; 5033 val = 10 * val + c - '0';
5032 break; 5034 break;
5033 } 5035 }
@@ -8554,7 +8556,7 @@ gs_load (struct frame *f, struct image *img)
8554 don't either. Let the Lisp loader use `unwind-protect' instead. */ 8556 don't either. Let the Lisp loader use `unwind-protect' instead. */
8555 printnum1 = FRAME_X_WINDOW (f); 8557 printnum1 = FRAME_X_WINDOW (f);
8556 printnum2 = img->pixmap; 8558 printnum2 = img->pixmap;
8557 window_and_pixmap_id 8559 window_and_pixmap_id
8558 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2); 8560 = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
8559 8561
8560 printnum1 = FRAME_FOREGROUND_PIXEL (f); 8562 printnum1 = FRAME_FOREGROUND_PIXEL (f);
diff --git a/src/nsimage.m b/src/nsimage.m
index 1479294948b..8a8a3ddaae4 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -302,7 +302,7 @@ static EmacsImage *ImageList = nil;
302 [bmRep release]; 302 [bmRep release];
303 return nil; 303 return nil;
304 } 304 }
305#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) 305#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
306 s1 = *s++; 306 s1 = *s++;
307 s2 = *s++; 307 s2 = *s++;
308 c = hexchar (s1) * 0x10 + hexchar (s2); 308 c = hexchar (s1) * 0x10 + hexchar (s2);
@@ -501,4 +501,3 @@ static EmacsImage *ImageList = nil;
501} 501}
502 502
503@end 503@end
504
diff --git a/src/nsterm.m b/src/nsterm.m
index 76e6ee8fb40..a628a248c77 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -36,6 +36,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
36#include <signal.h> 36#include <signal.h>
37#include <unistd.h> 37#include <unistd.h>
38#include <setjmp.h> 38#include <setjmp.h>
39
40#include <c-ctype.h>
39#include <c-strcase.h> 41#include <c-strcase.h>
40#include <ftoastr.h> 42#include <ftoastr.h>
41 43
@@ -6785,20 +6787,20 @@ ns_xlfd_to_fontname (const char *xlfd)
6785 6787
6786 /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' ' 6788 /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' '
6787 also uppercase after '-' or ' ' */ 6789 also uppercase after '-' or ' ' */
6788 name[0] = toupper (name[0]); 6790 name[0] = c_toupper (name[0]);
6789 for (len =strlen (name), i =0; i<len; i++) 6791 for (len =strlen (name), i =0; i<len; i++)
6790 { 6792 {
6791 if (name[i] == '$') 6793 if (name[i] == '$')
6792 { 6794 {
6793 name[i] = '-'; 6795 name[i] = '-';
6794 if (i+1<len) 6796 if (i+1<len)
6795 name[i+1] = toupper (name[i+1]); 6797 name[i+1] = c_toupper (name[i+1]);
6796 } 6798 }
6797 else if (name[i] == '_') 6799 else if (name[i] == '_')
6798 { 6800 {
6799 name[i] = ' '; 6801 name[i] = ' ';
6800 if (i+1<len) 6802 if (i+1<len)
6801 name[i+1] = toupper (name[i+1]); 6803 name[i+1] = c_toupper (name[i+1]);
6802 } 6804 }
6803 } 6805 }
6804/*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */ 6806/*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name); */
diff --git a/src/syntax.c b/src/syntax.c
index 1cbad1ae0a4..69965d1d824 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22 22
23#include <ctype.h>
24#include <sys/types.h> 23#include <sys/types.h>
25#include <setjmp.h> 24#include <setjmp.h>
26#include "lisp.h" 25#include "lisp.h"
diff --git a/src/sysdep.c b/src/sysdep.c
index 01ca905a987..1dbe8938e46 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#define SYSTIME_INLINE EXTERN_INLINE 22#define SYSTIME_INLINE EXTERN_INLINE
23 23
24#include <ctype.h>
25#include <signal.h> 24#include <signal.h>
26#include <stdio.h> 25#include <stdio.h>
27#include <setjmp.h> 26#include <setjmp.h>
@@ -33,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
33#include <unistd.h> 32#include <unistd.h>
34 33
35#include <allocator.h> 34#include <allocator.h>
35#include <c-ctype.h>
36#include <careadlinkat.h> 36#include <careadlinkat.h>
37#include <ignore-value.h> 37#include <ignore-value.h>
38#include <utimens.h> 38#include <utimens.h>
@@ -2733,7 +2733,7 @@ system_process_attributes (Lisp_Object pid)
2733 if (emacs_read (fd, &ch, 1) != 1) 2733 if (emacs_read (fd, &ch, 1) != 1)
2734 break; 2734 break;
2735 c = ch; 2735 c = ch;
2736 if (isspace (c) || c == '\\') 2736 if (c_isspace (c) || c == '\\')
2737 cmdline_size++; /* for later quoting, see below */ 2737 cmdline_size++; /* for later quoting, see below */
2738 } 2738 }
2739 if (cmdline_size) 2739 if (cmdline_size)
@@ -2757,7 +2757,7 @@ system_process_attributes (Lisp_Object pid)
2757 for (p = cmdline; p < cmdline + nread; p++) 2757 for (p = cmdline; p < cmdline + nread; p++)
2758 { 2758 {
2759 /* Escape-quote whitespace and backslashes. */ 2759 /* Escape-quote whitespace and backslashes. */
2760 if (isspace (*p) || *p == '\\') 2760 if (c_isspace (*p) || *p == '\\')
2761 { 2761 {
2762 memmove (p + 1, p, nread - (p - cmdline)); 2762 memmove (p + 1, p, nread - (p - cmdline));
2763 nread++; 2763 nread++;
diff --git a/src/term.c b/src/term.c
index 514c7ad11ec..c5cec3062e3 100644
--- a/src/term.c
+++ b/src/term.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <ctype.h>
25#include <errno.h> 24#include <errno.h>
26#include <sys/file.h> 25#include <sys/file.h>
27#include <sys/time.h> 26#include <sys/time.h>
diff --git a/src/xfaces.c b/src/xfaces.c
index ed372c6b419..7491802466d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -279,7 +279,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
279 279
280#endif /* HAVE_X_WINDOWS */ 280#endif /* HAVE_X_WINDOWS */
281 281
282#include <ctype.h> 282#include <c-ctype.h>
283 283
284/* Number of pt per inch (from the TeXbook). */ 284/* Number of pt per inch (from the TeXbook). */
285 285
@@ -4059,7 +4059,7 @@ hash_string_case_insensitive (Lisp_Object string)
4059 unsigned hash = 0; 4059 unsigned hash = 0;
4060 eassert (STRINGP (string)); 4060 eassert (STRINGP (string));
4061 for (s = SDATA (string); *s; ++s) 4061 for (s = SDATA (string); *s; ++s)
4062 hash = (hash << 1) ^ tolower (*s); 4062 hash = (hash << 1) ^ c_tolower (*s);
4063 return hash; 4063 return hash;
4064} 4064}
4065 4065
diff --git a/src/xfns.c b/src/xfns.c
index 2e7334b7d71..a9d22e7d3c6 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -49,7 +49,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
49 49
50#ifdef HAVE_X_WINDOWS 50#ifdef HAVE_X_WINDOWS
51 51
52#include <ctype.h>
53#include <sys/types.h> 52#include <sys/types.h>
54#include <sys/stat.h> 53#include <sys/stat.h>
55 54
diff --git a/src/xterm.c b/src/xterm.c
index 1b746f87d53..b1a73d07998 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -50,7 +50,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#include "systime.h" 50#include "systime.h"
51 51
52#include <fcntl.h> 52#include <fcntl.h>
53#include <ctype.h>
54#include <errno.h> 53#include <errno.h>
55#include <setjmp.h> 54#include <setjmp.h>
56#include <sys/stat.h> 55#include <sys/stat.h>