-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/29/2009 11:55 AM, Daniel Stenberg wrote: > Right, those that return a "standard struct" we can't do much about. I > really don't think we should add new APIs that return such structs but > we can leave the exsisting as they are to not stir anything up. > > For the ones that return an ares struct, we can either select to show > the magic to the user or hide it from the users by doing it: > > struct ares_hidden { > int magic; > struct ares_external { > int public; > } > } > > The ares_free() function would then use 'offsetof()' to figure out the > start address of the 'ares_hidden' struct, check what type that is > embedded > and then call the appropriate internal free function. > > And when we return a pointer to this struct over the API, we just return a > pointer to the external part. >
I would prefer this approach as IMHO no magic should be visible to the user. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAkrplVsACgkQHsardTLnvCVwqwCgi+Z/nYG/UcSNhn4RpFTX9M0N 3HQAoLhoB0JC5mlUa/G/vRxQOe6IsS3C =MgN5 -----END PGP SIGNATURE-----