* resolv/inet_addr.c (inet_aton): Fix last patch.  The little
	endian version works for both endiannesses.
This commit is contained in:
Ulrich Drepper 1999-10-14 19:28:27 +00:00
parent 907ea199d0
commit 1bf60c01b8
2 changed files with 5 additions and 14 deletions

View File

@ -1,5 +1,8 @@
1999-10-14 Andreas Jaeger <aj@suse.de> 1999-10-14 Andreas Jaeger <aj@suse.de>
* resolv/inet_addr.c (inet_aton): Fix last patch. The little
endian version works for both endiannesses.
* sysdeps/unix/sysv/linux/sleep.c (__sleep): Optimize for zero * sysdeps/unix/sysv/linux/sleep.c (__sleep): Optimize for zero
seconds. seconds.

View File

@ -107,11 +107,7 @@ inet_aton(cp, addr)
uint8_t bytes[4]; uint8_t bytes[4];
uint32_t word; uint32_t word;
} res; } res;
#if BYTE_ORDER == LITTLE_ENDIAN
register uint8_t *pp = res.bytes; register uint8_t *pp = res.bytes;
#else
register uint8_t *pp = &res.bytes[4];
#endif
int digit; int digit;
#ifdef _LIBC #ifdef _LIBC
@ -172,17 +168,10 @@ inet_aton(cp, addr)
* a.b.c (with c treated as 16 bits) * a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits) * a.b (with b treated as 24 bits)
*/ */
if ((BYTE_ORDER == LITTLE_ENDIAN if (pp >> res.bytes + 3
&& pp >= res.bytes + 3)
|| (BYTE_ORDER == BIG_ENDIAN
&& pp == res.bytes)
|| val > 0xff) || val > 0xff)
goto ret_0; goto ret_0;
#if BYTE_ORDER == LITTLE_ENDIAN
*pp++ = val; *pp++ = val;
#else
*--pp = val;
#endif
c = *++cp; c = *++cp;
} else } else
break; break;
@ -201,8 +190,7 @@ inet_aton(cp, addr)
/* Check whether the last part is in its limits depending on /* Check whether the last part is in its limits depending on
the number of parts in total. */ the number of parts in total. */
if ((BYTE_ORDER == LITTLE_ENDIAN && val > max[pp - res.bytes]) if (val > max[pp - res.bytes])
|| (BYTE_ORDER == BIG_ENDIAN && val > max[res.bytes - pp]))
goto ret_0; goto ret_0;
if (addr) if (addr)