; Use c-ctype.h in w32*.c

* src/w32.c:
* src/w32fns.c: Replace ctype.h functions by equivalent
c-ctype.h functions.
This commit is contained in:
Eli Zaretskii 2024-09-18 21:22:04 +03:00
parent 03a9919318
commit 252ed22d62
2 changed files with 11 additions and 11 deletions

View file

@ -32,7 +32,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <io.h> #include <io.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <ctype.h>
#include <signal.h> #include <signal.h>
#include <sys/file.h> #include <sys/file.h>
#include <time.h> /* must be before nt/inc/sys/time.h, for MinGW64 */ #include <time.h> /* must be before nt/inc/sys/time.h, for MinGW64 */
@ -264,6 +263,7 @@ typedef struct _REPARSE_DATA_BUFFER {
#include <wincrypt.h> #include <wincrypt.h>
#include <c-ctype.h>
#include <c-strcase.h> #include <c-strcase.h>
#include <utimens.h> /* for fdutimens */ #include <utimens.h> /* for fdutimens */
@ -2558,7 +2558,7 @@ parse_root (const char * name, const char ** pPath)
return 0; return 0;
/* find the root name of the volume if given */ /* find the root name of the volume if given */
if (isalpha (name[0]) && name[1] == ':') if (c_isalpha (name[0]) && name[1] == ':')
{ {
/* skip past drive specifier */ /* skip past drive specifier */
name += 2; name += 2;
@ -3311,7 +3311,7 @@ static BOOL fixed_drives[26];
at least for non-local drives. Info for fixed drives is never stale. */ at least for non-local drives. Info for fixed drives is never stale. */
#define DRIVE_INDEX( c ) ( (c) <= 'Z' ? (c) - 'A' : (c) - 'a' ) #define DRIVE_INDEX( c ) ( (c) <= 'Z' ? (c) - 'A' : (c) - 'a' )
#define VOLINFO_STILL_VALID( root_dir, info ) \ #define VOLINFO_STILL_VALID( root_dir, info ) \
( ( isalpha (root_dir[0]) && \ ( ( c_isalpha (root_dir[0]) && \
fixed_drives[ DRIVE_INDEX (root_dir[0]) ] ) \ fixed_drives[ DRIVE_INDEX (root_dir[0]) ] ) \
|| GetTickCount () - info->timestamp < 10000 ) || GetTickCount () - info->timestamp < 10000 )
@ -3380,7 +3380,7 @@ GetCachedVolumeInformation (char * root_dir)
involve network access, and so is extremely quick). */ involve network access, and so is extremely quick). */
/* Map drive letter to UNC if remote. */ /* Map drive letter to UNC if remote. */
if (isalpha (root_dir[0]) && !fixed[DRIVE_INDEX (root_dir[0])]) if (c_isalpha (root_dir[0]) && !fixed[DRIVE_INDEX (root_dir[0])])
{ {
char remote_name[ 256 ]; char remote_name[ 256 ];
char drive[3] = { root_dir[0], ':' }; char drive[3] = { root_dir[0], ':' };
@ -3595,7 +3595,7 @@ map_w32_filename (const char * name, const char ** pPath)
default: default:
if ( left && 'A' <= c && c <= 'Z' ) if ( left && 'A' <= c && c <= 'Z' )
{ {
*str++ = tolower (c); /* map to lower case (looks nicer) */ *str++ = c_tolower (c); /* map to lower case (looks nicer) */
left--; left--;
dots = 0; /* started a path component */ dots = 0; /* started a path component */
} }

View file

@ -937,13 +937,13 @@ x_to_w32_color (const char * colorname)
{ {
int len = strlen (colorname); int len = strlen (colorname);
if (isdigit (colorname[len - 1])) if (c_isdigit (colorname[len - 1]))
{ {
char *ptr, *approx = alloca (len + 1); char *ptr, *approx = alloca (len + 1);
strcpy (approx, colorname); strcpy (approx, colorname);
ptr = &approx[len - 1]; ptr = &approx[len - 1];
while (ptr > approx && isdigit (*ptr)) while (ptr > approx && c_isdigit (*ptr))
*ptr-- = '\0'; *ptr-- = '\0';
ret = w32_color_map_lookup (approx); ret = w32_color_map_lookup (approx);
@ -3725,7 +3725,7 @@ post_character_message (HWND hwnd, UINT msg,
message that has no particular effect. */ message that has no particular effect. */
{ {
int c = wParam; int c = wParam;
if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier) if (c_isalpha (c) && wmsg.dwModifiers == ctrl_modifier)
c = make_ctrl_char (c) & 0377; c = make_ctrl_char (c) & 0377;
if (c == quit_char if (c == quit_char
|| (wmsg.dwModifiers == 0 || (wmsg.dwModifiers == 0
@ -8748,7 +8748,7 @@ lookup_vk_code (char *key)
|| (key[0] >= '0' && key[0] <= '9')) || (key[0] >= '0' && key[0] <= '9'))
return key[0]; return key[0];
if (key[0] >= 'a' && key[0] <= 'z') if (key[0] >= 'a' && key[0] <= 'z')
return toupper(key[0]); return c_toupper (key[0]);
} }
} }
@ -9518,7 +9518,7 @@ DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
BOOL result; BOOL result;
/* find the root name of the volume if given */ /* find the root name of the volume if given */
if (isalpha (name[0]) && name[1] == ':') if (c_isalpha (name[0]) && name[1] == ':')
{ {
rootname[0] = name[0]; rootname[0] = name[0];
rootname[1] = name[1]; rootname[1] = name[1];