samba-technical@lists.samba.org
[Top] [All Lists]

RE: [PATCH] Minor style correction in util_sock

Subject: RE: [PATCH] Minor style correction in util_sock
From: "Zachary Loafman"
Date: Mon, 7 Jul 2008 19:43:19 -0700
This time with an actual patch attached.

> -----Original Message-----
> From:
samba-technical-bounces+zachary.loafman=isilon.com@xxxxxxxxxxxxxxx
> [mailto:samba-technical-
> bounces+zachary.loafman=isilon.com@xxxxxxxxxxxxxxx] On Behalf Of
Zachary
> Loafman
> Sent: Monday, July 07, 2008 7:37 PM
> To: Volker.Lendecke@xxxxxxxxx
> Cc: samba tech; Jeremy Allison
> Subject: [PATCH] Minor style correction in util_sock
> 
> > 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
> 
<Prev in Thread] Current Thread [Next in Thread>