[PATCH] Minor style correction in util_sock

Zachary Loafman zachary.loafman at isilon.com
Tue Jul 8 02:43:19 GMT 2008


This time with an actual patch attached.

> -----Original Message-----
> From:
samba-technical-bounces+zachary.loafman=isilon.com at lists.samba.org
> [mailto:samba-technical-
> bounces+zachary.loafman=isilon.com at lists.samba.org] On Behalf Of
Zachary
> Loafman
> Sent: Monday, July 07, 2008 7:37 PM
> To: Volker.Lendecke at SerNet.DE
> 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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Minor-style-correction.patch
Type: application/octet-stream
Size: 1100 bytes
Desc: 0005-Minor-style-correction.patch
Url : http://lists.samba.org/archive/samba-technical/attachments/20080707/396bac5a/0005-Minor-style-correction.obj


More information about the samba-technical mailing list