This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()
- From: Pavel Simerda <psimerda at redhat dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Date: Mon, 9 Dec 2013 08:42:41 -0500 (EST)
- Subject: [PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()
- Authentication-results: sourceware.org; auth=none
Call the first parameter 'nodename' and avoid its modification
throughout the whole function. Instead point 'name' to the same
const string and optionally repoint it to the IDN encoded version
later.
* sysdeps/posix/getaddrinfo.c (getaddrinfo_inet): Rename name to nodename.
(getaddrinfo_inet): Rename orig_name to name.
(getaddrinfo_inet): Use nodename instead of orig_name.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 94b21e9..5da0129 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -355,7 +355,7 @@ typedef enum nss_status (*nss_getcanonname_r)
extern service_user *__nss_hosts_database attribute_hidden;
static int
-getaddrinfo_inet (const char *name, const char *servname,
+getaddrinfo_inet (const char *nodename, const char *servname,
const struct addrinfo *req, struct addrinfo **pai,
unsigned int *naddrs)
{
@@ -363,7 +363,7 @@ getaddrinfo_inet (const char *name, const char *servname,
int rc;
bool got_ipv6 = false;
const char *canon = NULL;
- const char *orig_name = name;
+ const char *name = nodename;
size_t alloca_used = 0;
int error;
@@ -1109,7 +1109,7 @@ getaddrinfo_inet (const char *name, const char *servname,
if (canon == NULL)
/* If the canonical name cannot be determined, use
the passed in string. */
- canon = orig_name;
+ canon = nodename;
#ifdef HAVE_LIBIDN
if (req->ai_flags & AI_CANONIDN)