From 218d76e03413b532f72d47d2695be049d6a2aa64 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 20 Nov 2002 19:48:07 +0000 Subject: Update. 2002-11-20 Ulrich Drepper * 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 * 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 * intl/localealias.c (read_alias_file): Use only about 400 bytes of stack space instead of 16k. --- inet/getnameinfo.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'inet/getnameinfo.c') 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); -- cgit 1.4.1