[Patch] gethostbyname2 again
Fri Mar 6 05:45:00 GMT 2009
On Tue, Mar 03, 2009 at 12:50:21PM -0500, Pierre A. Humblet wrote:
>----- Original Message -----
>From: "Christopher Faylor" <>
>Sent: Tuesday, March 03, 2009 10:38 AM
>Subject: Re: [Patch] gethostbyname2 again
>| On Mon, Mar 02, 2009 at 08:36:55PM -0500, Pierre A. Humblet wrote:
>| > realloc_ent function, and call it from both dup_ent and the helper. That
>| > caused minor
>| > changes in the 4 versions of dup_ent, and I don't know exactly what
>| > format to use in the ChangeLog
>| I would rather that you keep dup_ent as is so that there is no need to
>| do run-time checks on the type. If you need to do something similar to
>| what is currently in dupent, then couldn't you still create a
>| realloc_ent but just pass in the destination pointer? Or even just make
>| realloc_ent mimic realloc but do the rounding that seems to be the
>| impetus for your breaking this out into a separate function.
>The impetus is that the new helper function is capable of formatting a fine
>hostent in a single block of memory. So it doesn't need to have dup_ent
>copy it in yet another memory block.
>However it still needs to store a pointer to the block of memory somewhere,
>so that it can be freed later, and reusing the tls.locals seems logical. If it does
>that, then it must also free or realloc whatever is stored there.
>That's what realloc_ent does.
>The rounding is not essential, it's just nice to do it consistently in one place.
>To avoid real-time checks, I could do as what dup_ent does, and have 4 versions
>of the realloc_ent function, one main one with dst and sz arguments (that one
>would be called by dup_ent without any run-time checks) and 3 (actually only
>1 is needed for now) that invoke the main one with the correct dst based on the
>type of the src argument . The src argument would be null but would have the
>right type! That seems to meet your wishes. OK?
More information about the Cygwin-patches