This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()
- From: Pavel Simerda <psimerda at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, Siddhesh Poyarekar <siddhesh at redhat dot com>
- Date: Mon, 9 Dec 2013 11:22:30 -0500 (EST)
- Subject: Re: [PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()
- Authentication-results: sourceware.org; auth=none
- References: <1921886851 dot 23954881 dot 1386596531453 dot JavaMail dot root at redhat dot com> <919982210 dot 23955005 dot 1386596561256 dot JavaMail dot root at redhat dot com> <20131209155720 dot GD29105 at domone dot podge>
----- Original Message -----
> From: "OndÅej BÃlka" <neleai@seznam.cz>
> To: "Pavel Simerda" <psimerda@redhat.com>
> Cc: "libc-alpha" <libc-alpha@sourceware.org>, "Siddhesh Poyarekar" <siddhesh@redhat.com>
> Sent: Monday, December 9, 2013 4:57:20 PM
> Subject: Re: [PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()
>
> On Mon, Dec 09, 2013 at 08:42:41AM -0500, Pavel Simerda wrote:
> > 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.
> >
> Change itself looks ok but I would like know if there is a follow-up as
> this does not improve code much by itself.
It's meant as a cleanup as changing the value of a parameter in the middle of such a huge function doesn't help readability much. And even if there is a follow-up from me, you won't probably like it because the only way to reasonably fix the code of this function is to rewrite it from scratch and do a *lot* of testing, in my opinion.
I'm working on a similar thing as part of the netresolve library for the purpose of nsswitch module testing:
https://sourceware.org/git/?p=netresolve.git;a=blob;f=backends/nss.c;h=a706fb7b94a46e3620ae4bfa5e3f5a4cdf5ce9f5;hb=HEAD
It's far from finished (other priorities for now) but it will never become the spaghetti you're seeing in glibc's gaih_inet(). In another libc-alpha e-mail, I proposed creating a _nss_*_gethostbyname5_r API that would be superior to all the previous APIs. I don't say it would solve the spaghetti problem by itself but it would be a good first step. Actually, a _nss_*_getaddrinfo API would be even better, and netresolve-style asynchronous API is something we can still only dream about...
Cheers,
Pavel