From 0db485a44836903c2854fc8c559e7874e5b9e4f0 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 13 Feb 2007 18:02:20 +0000 Subject: use our own ISUPPER and ISLOWER macros --- ares/inet_net_pton.c | 2 +- ares/setup_once.h | 2 ++ ares/windows_port.c | 4 ++-- lib/setup_once.h | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ares/inet_net_pton.c b/ares/inet_net_pton.c index 8c78a0b20..49bac69a6 100644 --- a/ares/inet_net_pton.c +++ b/ares/inet_net_pton.c @@ -86,7 +86,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size) dirty = 0; src++; /* skip x or X. */ while ((ch = *src++) != '\0' && ISXDIGIT(ch)) { - if (isupper(ch)) + if (ISUPPER(ch)) ch = tolower(ch); n = (int)(strchr(xdigits, ch) - xdigits); if (dirty == 0) diff --git a/ares/setup_once.h b/ares/setup_once.h index 6cfa526f7..187f5e1b5 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -122,6 +122,8 @@ #define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) #define ISALPHA(x) (isalpha((int) ((unsigned char)x))) #define ISPRINT(x) (isprint((int) ((unsigned char)x))) +#define ISUPPER(x) (isupper((int) ((unsigned char)x))) +#define ISLOWER(x) (islower((int) ((unsigned char)x))) /* diff --git a/ares/windows_port.c b/ares/windows_port.c index 2d842742a..dabe0bccc 100644 --- a/ares/windows_port.c +++ b/ares/windows_port.c @@ -41,8 +41,8 @@ ares_strncasecmp(const char *a, const char *b, int n) int i; for (i = 0; i < n; i++) { - int c1 = isupper(a[i]) ? tolower(a[i]) : a[i]; - int c2 = isupper(b[i]) ? tolower(b[i]) : b[i]; + int c1 = ISUPPER(a[i]) ? tolower(a[i]) : a[i]; + int c2 = ISUPPER(b[i]) ? tolower(b[i]) : b[i]; if (c1 != c2) return c1-c2; } return 0; diff --git a/lib/setup_once.h b/lib/setup_once.h index 445bb970b..1c4d6c99c 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -129,6 +129,8 @@ #define ISGRAPH(x) (isgraph((int) ((unsigned char)x))) #define ISALPHA(x) (isalpha((int) ((unsigned char)x))) #define ISPRINT(x) (isprint((int) ((unsigned char)x))) +#define ISUPPER(x) (isupper((int) ((unsigned char)x))) +#define ISLOWER(x) (islower((int) ((unsigned char)x))) /* -- cgit v1.2.3