cvs commit: src/sys/netinet/libalias alias_util.c

Max Laier max at love2party.net
Tue Dec 4 10:28:41 PST 2007


On Tuesday 04 December 2007, Alexey Dokuchaev wrote:
> On Mon, Dec 03, 2007 at 04:57:33PM -0500, John Baldwin wrote:
> > On Monday 03 December 2007 10:24:52 am Dag-Erling Sm??rgrav wrote:
> > > John Birrell <jb at FreeBSD.org> writes:
> > > >   Log:
> > > >   Fix strict alias warnings.
> > >
> > > A much simpler solution (relative to the previous revision):
> > >
> > > @@ -131,10 +131,10 @@
> > >                 sum += oddbyte;
> > >         }
> > >  /* "Pseudo-header" data */
> > > -       ptr = (u_short *) & (pip->ip_dst);
> > > +       ptr = (void *)&pip->ip_dst;
> > >         sum += *ptr++;
> > >         sum += *ptr;
> > > -       ptr = (u_short *) & (pip->ip_src);
> > > +       ptr = (void *)&pip->ip_src;
> > >         sum += *ptr++;
> > >         sum += *ptr;
> > >         sum += htons((u_short) ntcp);
> >
> > *ptr++ would choke since pointer arith on (void *) is undefined
> > AFAIK.
>
> I've been under impression that ++ on void * whould simply increase it
> by one.

wasn't that the reason why caddr_t exists?  i.e. pointer arithmetic on 
void * is bad, but on caddr_t it's kinda okay.

-- 
/"\  Best regards,                      | mlaier at freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier at EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20071204/2a9ecac6/attachment.pgp


More information about the cvs-src mailing list