summary refs log tree commit diff
path: root/resolv/inet_addr.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-04-28 11:01:01 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-04-28 12:53:49 +0200
commitc99c925b8b7ce7d023943878a41ad964c5ab7a04 (patch)
treed7310120ea798bd0b67fbc1297008facc904a5b1 /resolv/inet_addr.c
parent1f32be054b640fa7bcbc46441e24e185ab5184e3 (diff)
downloadglibc-c99c925b8b7ce7d023943878a41ad964c5ab7a04.tar.gz
glibc-c99c925b8b7ce7d023943878a41ad964c5ab7a04.tar.xz
glibc-c99c925b8b7ce7d023943878a41ad964c5ab7a04.zip
resolv: Remove _LIBC conditionals
Diffstat (limited to 'resolv/inet_addr.c')
-rw-r--r--resolv/inet_addr.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index a16b51386a..10d9a1e24d 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -72,13 +72,11 @@
 
 #include <ctype.h>
 
-#ifdef _LIBC
 # include <endian.h>
 # include <stdint.h>
 # include <stdlib.h>
 # include <limits.h>
 # include <errno.h>
-#endif
 
 /*
  * Ascii internet address interpretation routine.
@@ -106,9 +104,6 @@ __inet_aton(const char *cp, struct in_addr *addr)
 {
 	static const in_addr_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff };
 	in_addr_t val;
-#ifndef _LIBC
-	int base;
-#endif
 	char c;
 	union iaddr {
 	  uint8_t bytes[4];
@@ -117,10 +112,8 @@ __inet_aton(const char *cp, struct in_addr *addr)
 	uint8_t *pp = res.bytes;
 	int digit;
 
-#ifdef _LIBC
 	int saved_errno = errno;
 	__set_errno (0);
-#endif
 
 	res.word = 0;
 
@@ -133,7 +126,6 @@ __inet_aton(const char *cp, struct in_addr *addr)
 		 */
 		if (!isdigit(c))
 			goto ret_0;
-#ifdef _LIBC
 		{
 			char *endp;
 			unsigned long ul = strtoul (cp, (char **) &endp, 0);
@@ -146,33 +138,6 @@ __inet_aton(const char *cp, struct in_addr *addr)
 			cp = endp;
 		}
 		c = *cp;
-#else
-		val = 0; base = 10; digit = 0;
-		if (c == '0') {
-			c = *++cp;
-			if (c == 'x' || c == 'X')
-				base = 16, c = *++cp;
-			else {
-				base = 8;
-				digit = 1 ;
-			}
-		}
-		for (;;) {
-			if (isascii(c) && isdigit(c)) {
-				if (base == 8 && (c == '8' || c == '9'))
-					return (0);
-				val = (val * base) + (c - '0');
-				c = *++cp;
-				digit = 1;
-			} else if (base == 16 && isascii(c) && isxdigit(c)) {
-				val = (val << 4) |
-					(c + 10 - (islower(c) ? 'a' : 'A'));
-				c = *++cp;
-				digit = 1;
-			} else
-				break;
-		}
-#endif
 		if (c == '.') {
 			/*
 			 * Internet format:
@@ -206,15 +171,11 @@ __inet_aton(const char *cp, struct in_addr *addr)
 	if (addr != NULL)
 		addr->s_addr = res.word | htonl (val);
 
-#ifdef _LIBC
 	__set_errno (saved_errno);
-#endif
 	return (1);
 
 ret_0:
-#ifdef _LIBC
 	__set_errno (saved_errno);
-#endif
 	return (0);
 }
 weak_alias (__inet_aton, inet_aton)