aboutsummaryrefslogtreecommitdiff
path: root/ares/inet_net_pton.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-10-18 03:42:06 +0000
committerYang Tse <yangsita@gmail.com>2006-10-18 03:42:06 +0000
commit9c1ad0f9f7fef9e178f2a7b417db0131bb86097b (patch)
tree280275f1eb22cefec098a78378d5bea61bbebb7a /ares/inet_net_pton.c
parent71c6335293e4945262ab25b867d59be17ce12819 (diff)
Replace is*() macros with our own IS*() ones.
Get rid of non ANSI/ISO isascii().
Diffstat (limited to 'ares/inet_net_pton.c')
-rw-r--r--ares/inet_net_pton.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ares/inet_net_pton.c b/ares/inet_net_pton.c
index d3e672ba4..ef96741a6 100644
--- a/ares/inet_net_pton.c
+++ b/ares/inet_net_pton.c
@@ -79,14 +79,13 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
- && isascii((unsigned char)(src[1]))
- && isxdigit((unsigned char)(src[1]))) {
+ && ISXDIGIT(src[1])) {
/* Hexadecimal: Eat nybble string. */
if (size <= 0U)
goto emsgsize;
dirty = 0;
src++; /* skip x or X. */
- while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
+ while ((ch = *src++) != '\0' && ISXDIGIT(ch)) {
if (isupper(ch))
ch = tolower(ch);
n = (int)(strchr(xdigits, ch) - xdigits);
@@ -106,7 +105,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
goto emsgsize;
*dst++ = (unsigned char) (tmp << 4);
}
- } else if (isascii(ch) && isdigit(ch)) {
+ } else if (ISDIGIT(ch)) {
/* Decimal: eat dotted digit string. */
for (;;) {
tmp = 0;
@@ -117,7 +116,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
if (tmp > 255)
goto enoent;
} while ((ch = *src++) != '\0' &&
- isascii(ch) && isdigit(ch));
+ ISDIGIT(ch));
if (size-- <= 0U)
goto emsgsize;
*dst++ = (unsigned char) tmp;
@@ -126,15 +125,15 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
if (ch != '.')
goto enoent;
ch = *src++;
- if (!isascii(ch) || !isdigit(ch))
+ if (!ISDIGIT(ch))
goto enoent;
}
} else
goto enoent;
bits = -1;
- if (ch == '/' && isascii((unsigned char)(src[0])) &&
- isdigit((unsigned char)(src[0])) && dst > odst) {
+ if (ch == '/' &&
+ ISDIGIT(src[0]) && dst > odst) {
/* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */
bits = 0;
@@ -142,7 +141,7 @@ inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
n = (int)(strchr(digits, ch) - digits);
bits *= 10;
bits += n;
- } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
+ } while ((ch = *src++) != '\0' && ISDIGIT(ch));
if (ch != '\0')
goto enoent;
if (bits > 32)