This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/4] getaddrinfo: rename 'name' to 'nodename' in getaddrinfo_inet()


----- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]