summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acountry.c12
-rw-r--r--ares_getnameinfo.c4
-rw-r--r--setup_once.h2
3 files changed, 10 insertions, 8 deletions
diff --git a/acountry.c b/acountry.c
index 1de31d8..4c2816a 100644
--- a/acountry.c
+++ b/acountry.c
@@ -558,8 +558,8 @@ static void find_country_from_cname(const char *cname, struct in_addr addr)
unsigned long ip;
ip = ntohl(addr.s_addr);
- z0 = tolower(cname[0]);
- z1 = tolower(cname[1]);
+ z0 = TOLOWER(cname[0]);
+ z1 = TOLOWER(cname[1]);
ccopy = strdup(cname);
dot_4 = NULL;
@@ -577,8 +577,8 @@ static void find_country_from_cname(const char *cname, struct in_addr addr)
}
else if (ver_2)
{
- z0 = tolower(dot_4[1]);
- z1 = tolower(dot_4[2]);
+ z0 = TOLOWER(dot_4[1]);
+ z1 = TOLOWER(dot_4[2]);
if (z0 != 'z' && z1 != 'z')
{
printf("Unexpected CNAME %s (ver_2)\n", cname);
@@ -593,8 +593,8 @@ static void find_country_from_cname(const char *cname, struct in_addr addr)
if (ver_1)
{
- ccode_A2[0] = (char)tolower(cname[2]);
- ccode_A2[1] = (char)tolower(cname[3]);
+ ccode_A2[0] = (char)TOLOWER(cname[2]);
+ ccode_A2[1] = (char)TOLOWER(cname[3]);
ccode_A2[2] = '\0';
}
else
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c
index 49250ed..151d12d 100644
--- a/ares_getnameinfo.c
+++ b/ares_getnameinfo.c
@@ -408,8 +408,8 @@ static char *ares_striendstr(const char *s1, const char *s2)
c2 = s2;
while (c2 < s2+s2_len)
{
- lo1 = tolower(*c1);
- lo2 = tolower(*c2);
+ lo1 = TOLOWER(*c1);
+ lo2 = TOLOWER(*c2);
if (lo1 != lo2)
return NULL;
else
diff --git a/setup_once.h b/setup_once.h
index 17ef226..0c7c811 100644
--- a/setup_once.h
+++ b/setup_once.h
@@ -252,6 +252,8 @@ struct timeval {
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
(((unsigned char)x) == '\t'))
+#define TOLOWER(x) (tolower((int) ((unsigned char)x)))
+
/*
* 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.