[PATCH] Minor style correction in util_sock

Zachary Loafman zachary.loafman at isilon.com
Tue Jul 8 02:37:07 GMT 2008


> On Fri, Jul 04, 2008 at 01:31:34AM -0700, Zachary Loafman wrote:
> > That said, I still would've coded it as sa->sin_family = AF_INET.
> > Flip-flopping types is fugly. :)
> 
> Agreed. Feel free to submit a patch :-)

Attached. Now about those 4 I sent last week.. :)

> On the whole issue, if I get
> http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html
> right, going via a char * or a void * avoids the whole
> aliasing issue?

That article seems to have a good summary, yeah. Going through char *
fixes it, but honestly, I prefer the approach of breaking out the
aliased types into small (theoretically inline-able) functions. The
in_addr_to_sockaddr_storage function is actually a great example of how
to avoid aliasing issues - it handles the messy aliasing of the
sockaddr_storage struct so that the caller doesn't get bitten. Many
times you can write little wrappers like that.

...Zach
	


More information about the samba-technical mailing list