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

Alexey Dokuchaev danfe at FreeBSD.org
Thu Dec 6 05:47:43 PST 2007


On Wed, Dec 05, 2007 at 02:44:43AM +0600, Max Khon wrote:
> Ho!
> 
> Alexey Dokuchaev 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.
> 
> Nope. Read man 1 gcc about -Wpointer-arith

Right, I stand corrected.  I've been thinking that ++/-- is kinda
special.

./danfe


More information about the cvs-src mailing list