Zebediah Figura : kernelbase: Use ntdll ctype functions.

Alexandre Julliard julliard at winehq.org
Mon Jan 31 15:55:17 CST 2022


Module: wine
Branch: master
Commit: d0ed0b676c78702b48db2cb62866a6f09ef45feb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d0ed0b676c78702b48db2cb62866a6f09ef45feb

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Sat Jan 29 20:39:57 2022 -0600

kernelbase: Use ntdll ctype functions.

These were open-coded in 5933c2a6901218bc6ef7b6e808b0571fa96b542e, but there's
no reason not to use the ASCII versions from ntdll.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/path.c   | 18 ++++--------------
 dlls/kernelbase/string.c |  4 ----
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index 3503286a82a..5f983895576 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -36,13 +36,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(path);
 
-#define isalnum(ch)  (((ch) >= '0' && (ch) <= '9') || \
-                      ((ch) >= 'A' && (ch) <= 'Z') || \
-                      ((ch) >= 'a' && (ch) <= 'z'))
-#define isxdigit(ch) (((ch) >= '0' && (ch) <= '9') || \
-                      ((ch) >= 'A' && (ch) <= 'F') || \
-                      ((ch) >= 'a' && (ch) <= 'f'))
-
 static const char hexDigits[] = "0123456789ABCDEF";
 
 static const unsigned char hashdata_lookup[256] =
@@ -107,13 +100,12 @@ static WCHAR *heap_strdupAtoW(const char *str)
 
 static BOOL is_drive_spec( const WCHAR *str )
 {
-    return ((str[0] >= 'A' && str[0] <= 'Z') || (str[0] >= 'a' && str[0] <= 'z')) && str[1] == ':';
+    return isalpha( str[0] ) && str[1] == ':';
 }
 
 static BOOL is_escaped_drive_spec( const WCHAR *str )
 {
-    return ((str[0] >= 'A' && str[0] <= 'Z') || (str[0] >= 'a' && str[0] <= 'z')) &&
-        (str[1] == ':' || str[1] == '|');
+    return isalpha( str[0] ) && (str[1] == ':' || str[1] == '|');
 }
 
 static BOOL is_prefixed_unc(const WCHAR *string)
@@ -2794,8 +2786,7 @@ HRESULT WINAPI ParseURLA(const char *url, PARSEDURLA *result)
     if (result->cbSize != sizeof(*result))
         return E_INVALIDARG;
 
-    while (*ptr && ((*ptr >= 'a' && *ptr <= 'z') || (*ptr >= 'A' && *ptr <= 'Z') ||
-                    (*ptr >= '0' && *ptr <= '9') || *ptr == '-' || *ptr == '+' || *ptr == '.'))
+    while (*ptr && (isalnum( *ptr ) || *ptr == '-' || *ptr == '+' || *ptr == '.'))
         ptr++;
 
     if (*ptr != ':' || ptr <= url + 1)
@@ -4177,8 +4168,7 @@ static const WCHAR * scan_url(const WCHAR *start, DWORD *size, enum url_scan_typ
     switch (type)
     {
     case SCHEME:
-        while ((*start >= 'a' && *start <= 'z') || (*start >= '0' && *start <= '9') ||
-               *start == '+' || *start == '-' || *start == '.')
+        while ((isalnum( *start ) && !isupper( *start )) || *start == '+' || *start == '-' || *start == '.')
         {
             start++;
             (*size)++;
diff --git a/dlls/kernelbase/string.c b/dlls/kernelbase/string.c
index 29cc158202f..f5d4468ae6c 100644
--- a/dlls/kernelbase/string.c
+++ b/dlls/kernelbase/string.c
@@ -30,10 +30,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(string);
 
-#define isxdigit(ch) (((ch) >= '0' && (ch) <= '9') || \
-                      ((ch) >= 'A' && (ch) <= 'F') || \
-                      ((ch) >= 'a' && (ch) <= 'f'))
-
 static BOOL char_compare(WORD ch1, WORD ch2, DWORD flags)
 {
     char str1[3], str2[3];




More information about the wine-cvs mailing list