aboutsummaryrefslogtreecommitdiff
path: root/resolv/inet_addr.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-10-14 19:28:27 +0000
committerUlrich Drepper <drepper@redhat.com>1999-10-14 19:28:27 +0000
commit1bf60c01b827f480c65d5e5accdc4fa47825d5e1 (patch)
treebe0864ba40097b973cbe406b5ff414b46af2c232 /resolv/inet_addr.c
parent907ea199d0c9fb94aa311259b42ec9ab447562dc (diff)
downloadglibc-1bf60c01b827f480c65d5e5accdc4fa47825d5e1.zip
glibc-1bf60c01b827f480c65d5e5accdc4fa47825d5e1.tar.gz
glibc-1bf60c01b827f480c65d5e5accdc4fa47825d5e1.tar.bz2
Update.
* resolv/inet_addr.c (inet_aton): Fix last patch. The little endian version works for both endiannesses.
Diffstat (limited to 'resolv/inet_addr.c')
-rw-r--r--resolv/inet_addr.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index e7f56d4..68f6310 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -107,11 +107,7 @@ inet_aton(cp, addr)
uint8_t bytes[4];
uint32_t word;
} res;
-#if BYTE_ORDER == LITTLE_ENDIAN
register uint8_t *pp = res.bytes;
-#else
- register uint8_t *pp = &res.bytes[4];
-#endif
int digit;
#ifdef _LIBC
@@ -172,17 +168,10 @@ inet_aton(cp, addr)
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
- if ((BYTE_ORDER == LITTLE_ENDIAN
- && pp >= res.bytes + 3)
- || (BYTE_ORDER == BIG_ENDIAN
- && pp == res.bytes)
+ if (pp >> res.bytes + 3
|| val > 0xff)
goto ret_0;
-#if BYTE_ORDER == LITTLE_ENDIAN
*pp++ = val;
-#else
- *--pp = val;
-#endif
c = *++cp;
} else
break;
@@ -201,8 +190,7 @@ inet_aton(cp, addr)
/* Check whether the last part is in its limits depending on
the number of parts in total. */
- if ((BYTE_ORDER == LITTLE_ENDIAN && val > max[pp - res.bytes])
- || (BYTE_ORDER == BIG_ENDIAN && val > max[res.bytes - pp]))
+ if (val > max[pp - res.bytes])
goto ret_0;
if (addr)