]> code.delx.au - gnu-emacs/commitdiff
Use ASCII tests for character types.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Aug 2012 21:58:44 +0000 (14:58 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Aug 2012 21:58:44 +0000 (14:58 -0700)
* 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.

26 files changed:
admin/ChangeLog
admin/merge-gnulib
lwlib/ChangeLog
lwlib/lwlib-Xaw.c
lwlib/lwlib.c
lwlib/xlwmenu.c
src/ChangeLog
src/category.c
src/charset.c
src/dispnew.c
src/doc.c
src/doprnt.c
src/editfns.c
src/fileio.c
src/font.c
src/frame.c
src/gtkutil.c
src/image.c
src/nsimage.m
src/nsterm.m
src/syntax.c
src/sysdep.c
src/term.c
src/xfaces.c
src/xfns.c
src/xterm.c

index c579930d2bfdc0eb1b1ffc0f4cfc4cc867a61df3..ea977e80cfadaa17a73bd04cc1a402337395fcb0 100644 (file)
@@ -1,3 +1,10 @@
+2012-08-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use ASCII tests for character types.
+       * merge-gnulib (GNULIB_MODULES): Add c-ctype.  This documents a
+       new direct dependency; c-ctype was already being used indirectly
+       via other gnulib modules.
+
 2012-08-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        Use bool for Emacs Lisp booleans.
index c5b9eba5ee6adb238a4268004b5e6a769b5652a6..63865edf3ceca45a8fc0a7a3499d96751c93cda4 100755 (executable)
@@ -26,7 +26,7 @@
 GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
 
 GNULIB_MODULES='
-  alloca-opt c-strcase
+  alloca-opt c-ctype c-strcase
   careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
   dtoastr dtotimespec dup2 environ
   filemode getloadavg getopt-gnu gettime gettimeofday
index 8d36e2e22d7c46de170f99638fcf4018df4d9446..7d49d9b531bbc52935a93d328053b2b61fa61c1f 100644 (file)
@@ -1,3 +1,11 @@
+2012-08-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use ASCII tests for character types.
+       * lwlib-Xaw.c, lwlib.c, xlwmenu.c:
+       Don't include <ctype.h>; no longer needed.
+       * lwlib-Xaw.c (openFont):
+       * xlwmenu.c (openXftFont): Test just for ASCII digits.
+
 2012-08-01  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (config_h): Add conf_post.h.
index 7f834df1aad5af6f67e171bd64977e0b316ae85c..d37fb70fdb8098dbeb5c9346ff5dab3241bac6c1 100644 (file)
@@ -24,7 +24,6 @@ Boston, MA 02110-1301, USA.  */
 
 #include <stdio.h>
 #include <setjmp.h>
-#include <ctype.h>
 
 #include <lisp.h>
 
@@ -125,7 +124,7 @@ openFont (Widget widget, char *name)
   XftFont *fn;
 
   /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9.  */
-  while (i > 0 && isdigit (fname[i]))
+  while (i > 0 && '0' <= fname[i] && fname[i] <= '9')
     --i;
   if (fname[i] == ' ')
     {
index 5820be8d7a4dc3e9c923e6992682fd26bfbb0f12..ad3792dd59d7a3cf9508aa76fea508b63f1d4c2d 100644 (file)
@@ -28,7 +28,6 @@ Boston, MA 02110-1301, USA.  */
 
 #include <sys/types.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "lwlib-int.h"
 #include "lwlib-utils.h"
 #include <X11/StringDefs.h>
index e8831c37f8fdbb3fb62fcc01167d8ba921c9d6fd..c76cb1a3f386e2aae13a4a2d700b12c8381a2f89 100644 (file)
@@ -28,7 +28,6 @@ Boston, MA 02110-1301, USA.  */
 #include <lisp.h>
 
 #include <stdio.h>
-#include <ctype.h>
 
 #include <sys/types.h>
 #if (defined __sun) && !(defined SUNOS41)
@@ -1858,7 +1857,7 @@ openXftFont (XlwMenuWidget mw)
       int screen = XScreenNumberOfScreen (mw->core.screen);
       int len = strlen (fname), i = len-1;
       /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9.  */
-      while (i > 0 && isdigit (fname[i]))
+      while (i > 0 && '0' <= fname[i] && fname[i] <= '9')
         --i;
       if (fname[i] == ' ')
         {
index 95140401eb2d4089f57ebd95b4964d6d0f150da4..874088bb782b1d057c4651f1329ceba9c0b0c0cf 100644 (file)
@@ -1,3 +1,31 @@
+2012-08-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use ASCII tests for character types.
+       * category.c, dispnew.c, doprnt.c, editfns.c, syntax.c, term.c:
+       * xfns.c, xterm.c:
+       Don't include <ctype.h>; was not needed.
+       * charset.c, doc.c, fileio.c, font.c, frame.c, gtkutil.c, image.c:
+       * sysdep.c, xfaces.c:
+       Include <c-ctype.h> instead of <ctype.h>.
+       * nsterm.m: Include <c-ctype.h>.
+       * charset.c (read_hex):
+       * doc.c (Fsnarf_documentation):
+       * fileio.c (IS_DRIVE) [WINDOWSNT]:
+       (DRIVE_LETTER) [DOS_NT]:
+       (Ffile_name_directory, Fexpand_file_name)
+       (Fsubstitute_in_file_name):
+       * font.c (font_parse_xlfd, font_parse_fcname):
+       * frame.c (x_set_font_backend):
+       * gtkutil.c (xg_get_font):
+       * image.c (xbm_scan, xpm_scan, pbm_scan_number):
+       * nsimage.m (hexchar):
+       * nsterm.m (ns_xlfd_to_fontname):
+       * sysdep.c (system_process_attributes):
+       * 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.
+
 2012-08-16  Martin Rudalics  <rudalics@gmx.at>
 
        Consistently check windows for validity/liveness
index 3d5b3cff04a503a864dd57fa0a87b0247cbe33a2..246a7d35a6da4104efb513539e6dd6312beae848 100644 (file)
@@ -32,7 +32,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define CATEGORY_INLINE EXTERN_INLINE
 
-#include <ctype.h>
 #include <setjmp.h>
 #include "lisp.h"
 #include "character.h"
index fbbcefc491571ca7df2dbf20f670e93b01dd2d08..87c16e1200883b13d5a7fb74c2cb619e704ec9a9 100644 (file)
@@ -30,10 +30,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
 #include <unistd.h>
-#include <ctype.h>
 #include <limits.h>
 #include <sys/types.h>
 #include <setjmp.h>
+#include <c-ctype.h>
 #include "lisp.h"
 #include "character.h"
 #include "charset.h"
@@ -446,7 +446,7 @@ read_hex (FILE *fp, int *eof, int *overflow)
       return 0;
     }
   n = 0;
-  while (isxdigit (c = getc (fp)))
+  while (c_isxdigit (c = getc (fp)))
     {
       if (UINT_MAX >> 4 < n)
        *overflow = 1;
index b82761f8cadb5a4e69755c0362905d020be89060..3288faba61b65b4099d3e9445c6d42da8932494d 100644 (file)
@@ -23,7 +23,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <signal.h>
 #include <stdio.h>
-#include <ctype.h>
 #include <setjmp.h>
 #include <unistd.h>
 
index d17e90f11c09b74eb6e8d2d867a665687b709ba8..ed311d918d73f87f9c2e381df1ade35b8e93b7a0 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -22,11 +22,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <sys/types.h>
 #include <sys/file.h>  /* Must be after sys/types.h for USG*/
-#include <ctype.h>
 #include <setjmp.h>
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <c-ctype.h>
+
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
@@ -597,9 +598,9 @@ the same file name is found in the `doc-directory'.  */)
       {
         ptrdiff_t len;
 
-        while (*beg && isspace (*beg)) ++beg;
+        while (*beg && c_isspace (*beg)) ++beg;
 
-        for (end = beg; *end && ! isspace (*end); ++end)
+        for (end = beg; *end && ! c_isspace (*end); ++end)
           if (*end == '/') beg = end+1;  /* skip directory part  */
 
         len = end - beg;
index 63f05cb74e22b4ef90ac44de001376c3e046aabf..b36e946005da552fc2992b9aecb57af03f934d4c 100644 (file)
@@ -102,7 +102,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
-#include <ctype.h>
 #include <setjmp.h>
 #include <float.h>
 #include <unistd.h>
index 5ac012c8378eeea271d0b81ec42f4c8db6dd7410..b7feb73378215d11461a7f3f0e8dd4d84fd1fe2d 100644 (file)
@@ -44,7 +44,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/resource.h>
 #endif
 
-#include <ctype.h>
 #include <float.h>
 #include <limits.h>
 #include <intprops.h>
index eba157ea04263c5e1aed7c34a5615aaf24395591..5991a238ffc42e8917cb54257aa76051193fa082 100644 (file)
@@ -30,7 +30,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <pwd.h>
 #endif
 
-#include <ctype.h>
 #include <errno.h>
 
 #ifdef HAVE_LIBSELINUX
@@ -38,6 +37,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <selinux/context.h>
 #endif
 
+#include <c-ctype.h>
+
 #include "lisp.h"
 #include "intervals.h"
 #include "character.h"
@@ -67,12 +68,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z')
 #endif
 #ifdef WINDOWSNT
-#define IS_DRIVE(x) isalpha ((unsigned char) (x))
+#define IS_DRIVE(x) c_isalpha (x)
 #endif
 /* Need to lower-case the drive letter, or else expanded
    filenames will sometimes compare unequal, because
    `expand-file-name' doesn't always down-case the drive letter.  */
-#define DRIVE_LETTER(x) (tolower ((unsigned char) (x)))
+#define DRIVE_LETTER(x) c_tolower (x)
 #endif
 
 #include "systime.h"
@@ -364,7 +365,7 @@ Given a Unix syntax file name, returns a string ending in slash.  */)
          r += 2;
        }
 
-      if (getdefdir (toupper ((unsigned char) *beg) - 'A' + 1, r))
+      if (getdefdir (c_toupper (*beg) - 'A' + 1, r))
        {
          if (!IS_DIRECTORY_SEP (res[strlen (res) - 1]))
            strcat (res, "/");
@@ -1053,7 +1054,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
       if (!IS_DIRECTORY_SEP (nm[0]))
        {
          adir = alloca (MAXPATHLEN + 1);
-         if (!getdefdir (toupper (drive) - 'A' + 1, adir))
+         if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
            adir = NULL;
        }
       if (!adir)
@@ -1129,7 +1130,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
          adir = alloca (MAXPATHLEN + 1);
          if (drive)
            {
-             if (!getdefdir (toupper (drive) - 'A' + 1, adir))
+             if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
                newdir = "/";
            }
          else
@@ -1635,7 +1636,7 @@ those `/' is discarded.  */)
        else
          {
            o = p;
-           while (p != endp && (isalnum (*p) || *p == '_')) p++;
+           while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
            s = p;
          }
 
@@ -1698,7 +1699,7 @@ those `/' is discarded.  */)
        else
          {
            o = p;
-           while (p != endp && (isalnum (*p) || *p == '_')) p++;
+           while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
            s = p;
          }
 
index c3040b8aa3fa7f56f8f3bdab0a916fff1a4a1a3d..5b9e4f1cfcf9f3caee0d59330e93ed5d70ef1240 100644 (file)
@@ -23,9 +23,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <float.h>
 #include <stdio.h>
-#include <ctype.h>
 #include <setjmp.h>
 
+#include <c-ctype.h>
+
 #include "lisp.h"
 #include "character.h"
 #include "buffer.h"
@@ -1079,7 +1080,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
              p = f[XLFD_POINT_INDEX];
              if (*p == '[')
                point_size = parse_matrix (p);
-             else if (isdigit (*p))
+             else if (c_isdigit (*p))
                point_size = atoi (p), point_size /= 10;
              if (point_size >= 0)
                ASET (font, FONT_SIZE_INDEX, make_float (point_size));
@@ -1346,7 +1347,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
        {
          int decimal = 0, size_found = 1;
          for (q = p + 1; *q && *q != ':'; q++)
-           if (! isdigit (*q))
+           if (! c_isdigit (*q))
              {
                if (*q != '.' || decimal)
                  {
@@ -1474,7 +1475,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
 
       /* Scan backwards from the end, looking for a size.  */
       for (p = name + len - 1; p >= name; p--)
-       if (!isdigit (*p))
+       if (!c_isdigit (*p))
          break;
 
       if ((p < name + len - 1) && ((p + 1 == name) || *p == ' '))
index ea682835a87737cd50246d1141aa64bc33f60120..9dabae55abcaee344f39db9e3e360471beb55a60 100644 (file)
@@ -20,10 +20,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 
 #include <stdio.h>
-#include <ctype.h>
 #include <errno.h>
 #include <limits.h>
 #include <setjmp.h>
+
+#include <c-ctype.h>
+
 #include "lisp.h"
 #include "character.h"
 #ifdef HAVE_X_WINDOWS
@@ -3271,7 +3273,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
       new_value = Qnil;
       while (*p0)
        {
-         while (*p1 && ! isspace (*p1) && *p1 != ',') p1++;
+         while (*p1 && ! c_isspace (*p1) && *p1 != ',') p1++;
          if (p0 < p1)
            new_value = Fcons (Fintern (make_string (p0, p1 - p0), Qnil),
                               new_value);
@@ -3279,7 +3281,7 @@ x_set_font_backend (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
            {
              int c;
 
-             while ((c = *++p1) && isspace (c));
+             while ((c = *++p1) && c_isspace (c));
            }
          p0 = p1;
        }
index a4de47f073c2f28e4da3ef4e3808d2d9759b0c99..2941605d4481465f0b79609c5373789bab860d55 100644 (file)
@@ -24,7 +24,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <signal.h>
 #include <stdio.h>
 #include <setjmp.h>
-#include <ctype.h>
+
+#include <c-ctype.h>
+
 #include "lisp.h"
 #include "xterm.h"
 #include "blockinput.h"
@@ -2072,7 +2074,7 @@ xg_get_font (FRAME_PTR f, const char *default_name)
       if (p)
         {
           char *ep = p+1;
-          while (isdigit (*ep))
+          while (c_isdigit (*ep))
             ++ep;
           if (*ep == '\0') *p = ' ';
         }
index 8a318c2f6ecd628f2a6179b75f749e4703d8206a..f2778165ece9dccd0b1b5c1d111ebe7259bffdf2 100644 (file)
@@ -20,7 +20,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <stdio.h>
 #include <math.h>
-#include <ctype.h>
 #include <unistd.h>
 
 #ifdef HAVE_PNG
@@ -33,6 +32,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <setjmp.h>
 
+#include <c-ctype.h>
+
 /* This makes the fields of a Display accessible, in Xlib header files.  */
 
 #define XLIB_ILLEGAL_ACCESS
@@ -2405,12 +2406,12 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
  loop:
 
   /* Skip white space.  */
-  while (*s < end && (c = *(*s)++, isspace (c)))
+  while (*s < end && (c = *(*s)++, c_isspace (c)))
     ;
 
   if (*s >= end)
     c = 0;
-  else if (isdigit (c))
+  else if (c_isdigit (c))
     {
       int value = 0, digit;
 
@@ -2422,7 +2423,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
              while (*s < end)
                {
                  c = *(*s)++;
-                 if (isdigit (c))
+                 if (c_isdigit (c))
                    digit = c - '0';
                  else if (c >= 'a' && c <= 'f')
                    digit = c - 'a' + 10;
@@ -2433,11 +2434,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
                  value = 16 * value + digit;
                }
            }
-         else if (isdigit (c))
+         else if (c_isdigit (c))
            {
              value = c - '0';
              while (*s < end
-                    && (c = *(*s)++, isdigit (c)))
+                    && (c = *(*s)++, c_isdigit (c)))
                value = 8 * value + c - '0';
            }
        }
@@ -2445,7 +2446,7 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
        {
          value = c - '0';
          while (*s < end
-                && (c = *(*s)++, isdigit (c)))
+                && (c = *(*s)++, c_isdigit (c)))
            value = 10 * value + c - '0';
        }
 
@@ -2454,11 +2455,11 @@ xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
       *ival = value;
       c = XBM_TK_NUMBER;
     }
-  else if (isalpha (c) || c == '_')
+  else if (c_isalpha (c) || c == '_')
     {
       *sval++ = c;
       while (*s < end
-            && (c = *(*s)++, (isalnum (c) || c == '_')))
+            && (c = *(*s)++, (c_isalnum (c) || c == '_')))
        *sval++ = c;
       *sval = 0;
       if (*s < end)
@@ -3661,16 +3662,17 @@ xpm_scan (const unsigned char **s,
   while (*s < end)
     {
       /* Skip white-space.  */
-      while (*s < end && (c = *(*s)++, isspace (c)))
+      while (*s < end && (c = *(*s)++, c_isspace (c)))
        ;
 
       /* gnus-pointer.xpm uses '-' in its identifier.
         sb-dir-plus.xpm uses '+' in its identifier.  */
-      if (isalpha (c) || c == '_' || c == '-' || c == '+')
+      if (c_isalpha (c) || c == '_' || c == '-' || c == '+')
        {
          *beg = *s - 1;
          while (*s < end
-                && (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+'))
+                && (c = **s, c_isalnum (c)
+                    || c == '_' || c == '-' || c == '+'))
              ++*s;
          *len = *s - *beg;
          return XPM_TK_IDENT;
@@ -5014,7 +5016,7 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
   while (*s < end)
     {
       /* Skip white-space.  */
-      while (*s < end && (c = *(*s)++, isspace (c)))
+      while (*s < end && (c = *(*s)++, c_isspace (c)))
        ;
 
       if (c == '#')
@@ -5023,11 +5025,11 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
          while (*s < end && (c = *(*s)++, c != '\n'))
            ;
        }
-      else if (isdigit (c))
+      else if (c_isdigit (c))
        {
          /* Read decimal number.  */
          val = c - '0';
-         while (*s < end && (c = *(*s)++, isdigit (c)))
+         while (*s < end && (c = *(*s)++, c_isdigit (c)))
            val = 10 * val + c - '0';
          break;
        }
@@ -8554,7 +8556,7 @@ gs_load (struct frame *f, struct image *img)
      don't either.  Let the Lisp loader use `unwind-protect' instead.  */
   printnum1 = FRAME_X_WINDOW (f);
   printnum2 = img->pixmap;
-  window_and_pixmap_id 
+  window_and_pixmap_id
     = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
 
   printnum1 = FRAME_FOREGROUND_PIXEL (f);
index 1479294948bf707d5a28a29f9f7bbc9787698a2e..8a8a3ddaae4a2d6cc7cd3f47b5e9f021ab4449e4 100644 (file)
@@ -302,7 +302,7 @@ static EmacsImage *ImageList = nil;
                   [bmRep release];
                   return nil;
                 }
-#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
+#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
               s1 = *s++;
               s2 = *s++;
               c = hexchar (s1) * 0x10 + hexchar (s2);
@@ -501,4 +501,3 @@ static EmacsImage *ImageList = nil;
 }
 
 @end
-
index 76e6ee8fb4074cfb7f4dcb77f251ba342fee7dbd..a628a248c77c13bc1c3000d3d6fcbff9e6e95086 100644 (file)
@@ -36,6 +36,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 #include <signal.h>
 #include <unistd.h>
 #include <setjmp.h>
+
+#include <c-ctype.h>
 #include <c-strcase.h>
 #include <ftoastr.h>
 
@@ -6785,20 +6787,20 @@ ns_xlfd_to_fontname (const char *xlfd)
 
   /* undo hack in ns_fontname_to_xlfd, converting '$' to '-', '_' to ' '
      also uppercase after '-' or ' ' */
-  name[0] = toupper (name[0]);
+  name[0] = c_toupper (name[0]);
   for (len =strlen (name), i =0; i<len; i++)
     {
       if (name[i] == '$')
         {
           name[i] = '-';
           if (i+1<len)
-            name[i+1] = toupper (name[i+1]);
+            name[i+1] = c_toupper (name[i+1]);
         }
       else if (name[i] == '_')
         {
           name[i] = ' ';
           if (i+1<len)
-            name[i+1] = toupper (name[i+1]);
+            name[i+1] = c_toupper (name[i+1]);
         }
     }
 /*fprintf (stderr, "converted '%s' to '%s'\n",xlfd,name);  */
index 1cbad1ae0a43d718c6d47f50532d07ac005ca3ed..69965d1d8243ccedfe11e453cbea159de1a6e364 100644 (file)
@@ -20,7 +20,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
-#include <ctype.h>
 #include <sys/types.h>
 #include <setjmp.h>
 #include "lisp.h"
index 01ca905a987c9a5ff7712a51d1e04a898dfca886..1dbe8938e464432d1130a551b67f4eed61438ef5 100644 (file)
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define SYSTIME_INLINE EXTERN_INLINE
 
-#include <ctype.h>
 #include <signal.h>
 #include <stdio.h>
 #include <setjmp.h>
@@ -33,6 +32,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 
 #include <allocator.h>
+#include <c-ctype.h>
 #include <careadlinkat.h>
 #include <ignore-value.h>
 #include <utimens.h>
@@ -2733,7 +2733,7 @@ system_process_attributes (Lisp_Object pid)
          if (emacs_read (fd, &ch, 1) != 1)
            break;
          c = ch;
-         if (isspace (c) || c == '\\')
+         if (c_isspace (c) || c == '\\')
            cmdline_size++;     /* for later quoting, see below */
        }
       if (cmdline_size)
@@ -2757,7 +2757,7 @@ system_process_attributes (Lisp_Object pid)
          for (p = cmdline; p < cmdline + nread; p++)
            {
              /* Escape-quote whitespace and backslashes.  */
-             if (isspace (*p) || *p == '\\')
+             if (c_isspace (*p) || *p == '\\')
                {
                  memmove (p + 1, p, nread - (p - cmdline));
                  nread++;
index 514c7ad11ec15fd98969407845b83bdfd6ff870f..c5cec3062e38ca3a1371a812baa2ae6b1f9a6217 100644 (file)
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 #include <stdio.h>
-#include <ctype.h>
 #include <errno.h>
 #include <sys/file.h>
 #include <sys/time.h>
index ed372c6b419445579c87efade0db2d184253ad8a..7491802466de8c50d6d3b05a866975aad97b9dcf 100644 (file)
@@ -279,7 +279,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #endif /* HAVE_X_WINDOWS */
 
-#include <ctype.h>
+#include <c-ctype.h>
 
 /* Number of pt per inch (from the TeXbook).  */
 
@@ -4059,7 +4059,7 @@ hash_string_case_insensitive (Lisp_Object string)
   unsigned hash = 0;
   eassert (STRINGP (string));
   for (s = SDATA (string); *s; ++s)
-    hash = (hash << 1) ^ tolower (*s);
+    hash = (hash << 1) ^ c_tolower (*s);
   return hash;
 }
 
index 2e7334b7d71b858c2bcd899c3b7c488cc2f48f8d..a9d22e7d3c6e36a44923c3a0327ff8f1605b8d2f 100644 (file)
@@ -49,7 +49,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifdef HAVE_X_WINDOWS
 
-#include <ctype.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
index 1b746f87d53a0dff48f620e8d1c32b9406ddb39e..b1a73d07998f13217d97c34b6e5e0ce0bac51204 100644 (file)
@@ -50,7 +50,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "systime.h"
 
 #include <fcntl.h>
-#include <ctype.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/stat.h>