svn commit: trunk/uClibc/libc/inet

bernds at uclibc.org bernds at uclibc.org
Thu Jun 12 10:00:42 UTC 2008


Author: bernds
Date: 2008-06-12 03:00:41 -0700 (Thu, 12 Jun 2008)
New Revision: 22299

Log:
Revert revision 19343 and also remove libc_hidden_proto for __uc_malloc.
For now, a straight revert; we can decide later wheter we want to do something
more.


Modified:
   trunk/uClibc/libc/inet/resolv.c


Changeset:
Modified: trunk/uClibc/libc/inet/resolv.c
===================================================================
--- trunk/uClibc/libc/inet/resolv.c	2008-06-12 07:27:48 UTC (rev 22298)
+++ trunk/uClibc/libc/inet/resolv.c	2008-06-12 10:00:41 UTC (rev 22299)
@@ -146,7 +146,6 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
-#include <malloc.h>
 #include <unistd.h>
 #include <resolv.h>
 #include <netdb.h>
@@ -219,7 +218,6 @@
 #elif defined __UCLIBC_HAS_CTYPE_TABLES__
 libc_hidden_proto(__ctype_b)
 #endif
-libc_hidden_proto(__uc_malloc)
 int __libc_getdomainname(char *name, size_t len);
 libc_hidden_proto(__libc_getdomainname)
 
@@ -1150,17 +1148,13 @@
 
 struct hostent *gethostbyname(const char *name)
 {
-	static struct {
-		struct hostent h;
-		char buf[sizeof(struct in_addr) +
-					sizeof(struct in_addr *)*2 +
-					sizeof(char *)*ALIAS_DIM + 384/*namebuffer*/ + 32/* margin */];
-	} *sp;
+	static struct hostent h;
+	static char buf[sizeof(struct in_addr) +
+			sizeof(struct in_addr *)*2 +
+			sizeof(char *)*ALIAS_DIM + 384/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
 
-	free(sp);
-	sp = __uc_malloc(sizeof(*sp));
-	gethostbyname_r(name, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno);
+	gethostbyname_r(name, &h, buf, sizeof(buf), &hp, &h_errno);
 
 	return hp;
 }
@@ -1174,17 +1168,13 @@
 #ifndef __UCLIBC_HAS_IPV6__
 	return family == AF_INET ? gethostbyname(name) : (struct hostent*)0;
 #else /* __UCLIBC_HAS_IPV6__ */
-	static struct {
-		struct hostent h;
-		char buf[sizeof(struct in6_addr) +
-					sizeof(struct in6_addr *)*2 +
-					sizeof(char *)*ALIAS_DIM + 384/*namebuffer*/ + 32/* margin */];
-	} *sp;
+	static struct hostent h;
+	static char buf[sizeof(struct in6_addr) +
+			sizeof(struct in6_addr *)*2 +
+			sizeof(char *)*ALIAS_DIM + 384/*namebuffer*/ + 32/* margin */];
 	struct hostent *hp;
 
-	free(sp);
-	sp = __uc_malloc(sizeof(*sp));
-	gethostbyname2_r(name, family, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno);
+	gethostbyname2_r(name, family, &h, buf, sizeof(buf), &hp, &h_errno);
 
 	return hp;
 #endif /* __UCLIBC_HAS_IPV6__ */
@@ -1521,21 +1511,17 @@
 #ifdef L_gethostbyaddr
 struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
 {
-	static struct {
-		struct hostent h;
-		char buf[
+	static struct hostent h;
+	static char buf[
 #ifndef __UCLIBC_HAS_IPV6__
 			sizeof(struct in_addr) + sizeof(struct in_addr *)*2 +
 #else
 			sizeof(struct in6_addr) + sizeof(struct in6_addr *)*2 +
 #endif /* __UCLIBC_HAS_IPV6__ */
 			sizeof(char *)*ALIAS_DIM + 384 /*namebuffer*/ + 32 /* margin */];
-	} *sp;
 	struct hostent *hp;
 
-	free(sp);
-	sp = __uc_malloc(sizeof(*sp));
-	gethostbyaddr_r(addr, len, type, &sp->h, sp->buf, sizeof(sp->buf), &hp, &h_errno);
+	gethostbyaddr_r(addr, len, type, &h, buf, sizeof(buf), &hp, &h_errno);
 
 	return hp;
 }
@@ -1770,9 +1756,8 @@
 
 struct hostent *gethostent(void)
 {
-	static struct {
-		struct hostent h;
-		char buf[
+	static struct hostent h;
+	static char buf[
 #ifndef __UCLIBC_HAS_IPV6__
 			sizeof(struct in_addr) + sizeof(struct in_addr *)*2 +
 #else
@@ -1780,13 +1765,10 @@
 #endif /* __UCLIBC_HAS_IPV6__ */
 			sizeof(char *)*ALIAS_DIM +
 			80 /*namebuffer*/ + 2 /* margin */];
-	} *sp;
 	struct hostent *host;
 
-	free(sp);
-	sp = __uc_malloc(sizeof(*sp));
 	__UCLIBC_MUTEX_LOCK(mylock);
-	gethostent_r(&sp->h, sp->buf, sizeof(sp->buf), &host, &h_errno);
+	gethostent_r(&h, buf, sizeof(buf), &host, &h_errno);
 	__UCLIBC_MUTEX_UNLOCK(mylock);
 	return host;
 }




More information about the uClibc-cvs mailing list