* 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.
+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.
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
+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.
#include <stdio.h>
#include <setjmp.h>
-#include <ctype.h>
#include <lisp.h>
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] == ' ')
{
#include <sys/types.h>
#include <stdio.h>
-#include <ctype.h>
#include "lwlib-int.h"
#include "lwlib-utils.h"
#include <X11/StringDefs.h>
#include <lisp.h>
#include <stdio.h>
-#include <ctype.h>
#include <sys/types.h>
#if (defined __sun) && !(defined SUNOS41)
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] == ' ')
{
+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
#define CATEGORY_INLINE EXTERN_INLINE
-#include <ctype.h>
#include <setjmp.h>
#include "lisp.h"
#include "character.h"
#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"
return 0;
}
n = 0;
- while (isxdigit (c = getc (fp)))
+ while (c_isxdigit (c = getc (fp)))
{
if (UINT_MAX >> 4 < n)
*overflow = 1;
#include <signal.h>
#include <stdio.h>
-#include <ctype.h>
#include <setjmp.h>
#include <unistd.h>
#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"
{
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;
#include <config.h>
#include <stdio.h>
-#include <ctype.h>
#include <setjmp.h>
#include <float.h>
#include <unistd.h>
#include <sys/resource.h>
#endif
-#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <intprops.h>
#include <pwd.h>
#endif
-#include <ctype.h>
#include <errno.h>
#ifdef HAVE_LIBSELINUX
#include <selinux/context.h>
#endif
+#include <c-ctype.h>
+
#include "lisp.h"
#include "intervals.h"
#include "character.h"
#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"
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, "/");
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)
adir = alloca (MAXPATHLEN + 1);
if (drive)
{
- if (!getdefdir (toupper (drive) - 'A' + 1, adir))
+ if (!getdefdir (c_toupper (drive) - 'A' + 1, adir))
newdir = "/";
}
else
else
{
o = p;
- while (p != endp && (isalnum (*p) || *p == '_')) p++;
+ while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
s = p;
}
else
{
o = p;
- while (p != endp && (isalnum (*p) || *p == '_')) p++;
+ while (p != endp && (c_isalnum (*p) || *p == '_')) p++;
s = p;
}
#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"
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));
{
int decimal = 0, size_found = 1;
for (q = p + 1; *q && *q != ':'; q++)
- if (! isdigit (*q))
+ if (! c_isdigit (*q))
{
if (*q != '.' || decimal)
{
/* 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 == ' '))
#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
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);
{
int c;
- while ((c = *++p1) && isspace (c));
+ while ((c = *++p1) && c_isspace (c));
}
p0 = p1;
}
#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"
if (p)
{
char *ep = p+1;
- while (isdigit (*ep))
+ while (c_isdigit (*ep))
++ep;
if (*ep == '\0') *p = ' ';
}
#include <config.h>
#include <stdio.h>
#include <math.h>
-#include <ctype.h>
#include <unistd.h>
#ifdef HAVE_PNG
#include <setjmp.h>
+#include <c-ctype.h>
+
/* This makes the fields of a Display accessible, in Xlib header files. */
#define XLIB_ILLEGAL_ACCESS
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;
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;
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';
}
}
{
value = c - '0';
while (*s < end
- && (c = *(*s)++, isdigit (c)))
+ && (c = *(*s)++, c_isdigit (c)))
value = 10 * value + c - '0';
}
*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)
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;
while (*s < end)
{
/* Skip white-space. */
- while (*s < end && (c = *(*s)++, isspace (c)))
+ while (*s < end && (c = *(*s)++, c_isspace (c)))
;
if (c == '#')
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;
}
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);
[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);
}
@end
-
#include <signal.h>
#include <unistd.h>
#include <setjmp.h>
+
+#include <c-ctype.h>
#include <c-strcase.h>
#include <ftoastr.h>
/* 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); */
#include <config.h>
-#include <ctype.h>
#include <sys/types.h>
#include <setjmp.h>
#include "lisp.h"
#define SYSTIME_INLINE EXTERN_INLINE
-#include <ctype.h>
#include <signal.h>
#include <stdio.h>
#include <setjmp.h>
#include <unistd.h>
#include <allocator.h>
+#include <c-ctype.h>
#include <careadlinkat.h>
#include <ignore-value.h>
#include <utimens.h>
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)
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++;
#include <config.h>
#include <stdio.h>
-#include <ctype.h>
#include <errno.h>
#include <sys/file.h>
#include <sys/time.h>
#endif /* HAVE_X_WINDOWS */
-#include <ctype.h>
+#include <c-ctype.h>
/* Number of pt per inch (from the TeXbook). */
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;
}
#ifdef HAVE_X_WINDOWS
-#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "systime.h"
#include <fcntl.h>
-#include <ctype.h>
#include <errno.h>
#include <setjmp.h>
#include <sys/stat.h>