summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-11-20 19:48:07 +0000
committerUlrich Drepper <drepper@redhat.com>2002-11-20 19:48:07 +0000
commit218d76e03413b532f72d47d2695be049d6a2aa64 (patch)
tree62e2c8e6d83f795d72be1266218b17ad61bc168d /inet
parent832737d5e2b924f18884c78d253e8a950c07fcc5 (diff)
downloadglibc-218d76e03413b532f72d47d2695be049d6a2aa64.tar.gz
glibc-218d76e03413b532f72d47d2695be049d6a2aa64.tar.xz
glibc-218d76e03413b532f72d47d2695be049d6a2aa64.zip
Update.
2002-11-20  Ulrich Drepper  <drepper@redhat.com>

	* inet/getnameinfo.c: Use extend_alloca where appropriate.
	* sysdeps/posix/getaddrinfo.c: Likewise.

	* include/alloca.h (extend_alloca): New define.  Based on stack
	direction it'll try to append to the previouls allocated buffer.

2002-11-07  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/posix/getaddrinfo.c (gaih_inet): If AF_UNSPEC is set,
	use the same service for AF_INET and AF_INET6.

2002-11-19  Ulrich Drepper  <drepper@redhat.com>

	* intl/localealias.c (read_alias_file): Use only about 400 bytes
	of stack space instead of 16k.
Diffstat (limited to 'inet')
-rw-r--r--inet/getnameinfo.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 063bec4c79..50197f8672 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -82,10 +82,7 @@ nrl_domainname (void)
 				    &herror))
 	    {
 	      if (herror == NETDB_INTERNAL && errno == ERANGE)
-		{
-		  tmpbuflen *= 2;
-		  tmpbuf = alloca (tmpbuflen);
-		}
+		tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
 	      else
 		break;
 	    }
@@ -97,10 +94,7 @@ nrl_domainname (void)
 	      /* The name contains no domain information.  Use the name
 		 now to get more information.  */
 	      while (__gethostname (tmpbuf, tmpbuflen))
-		{
-		  tmpbuflen *= 2;
-		  tmpbuf = alloca (tmpbuflen);
-		}
+		tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
 
 	      if ((c = strchr (tmpbuf, '.')))
 		domain = __strdup (++c);
@@ -113,10 +107,8 @@ nrl_domainname (void)
 					    &h, &herror))
 		    {
 		      if (herror == NETDB_INTERNAL && errno == ERANGE)
-			{
-			  tmpbuflen *= 2;
-			  tmpbuf = alloca (tmpbuflen);
-			}
+			tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
+						2 * tmpbuflen);
 		      else
 			break;
 		    }
@@ -135,10 +127,8 @@ nrl_domainname (void)
 						tmpbuflen, &h, &herror))
 			{
 			  if (herror == NETDB_INTERNAL && errno == ERANGE)
-			    {
-			      tmpbuflen *= 2;
-			      tmpbuf = alloca (tmpbuflen);
-			    }
+			    tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
+						    2 * tmpbuflen);
 			  else
 			    break;
 			}
@@ -213,10 +203,8 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 			if (herrno == NETDB_INTERNAL)
 			  {
 			    if (errno == ERANGE)
-			      {
-				tmpbuflen *= 2;
-				tmpbuf = alloca (tmpbuflen);
-			      }
+			      tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
+						      2 * tmpbuflen);
 			    else
 			      {
 				__set_h_errno (herrno);
@@ -238,10 +226,8 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 					      &h, &herrno))
 		      {
 			if (errno == ERANGE)
-			  {
-			    tmpbuflen *= 2;
-			    tmpbuf = alloca (tmpbuflen);
-			  }
+			  tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
+						  2 * tmpbuflen);
 			else
 			  {
 			    break;
@@ -384,10 +370,8 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 		if (herrno == NETDB_INTERNAL)
 		  {
 		    if (errno == ERANGE)
-		      {
-			tmpbuflen *= 2;
-			tmpbuf = __alloca (tmpbuflen);
-		      }
+		      tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
+					      2 * tmpbuflen);
 		    else
 		      {
 			__set_errno (serrno);