[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170614121416.63a78b0d@xeon-e3>
Date: Wed, 14 Jun 2017 12:14:16 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: yuan linyu <cugyly@....com>, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
yuan linyu <Linyu.Yuan@...atel-sbell.com.cn>
Subject: Re: [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize
code
On Wed, 14 Jun 2017 21:01:32 +0200
Johannes Berg <johannes@...solutions.net> wrote:
> On Wed, 2017-06-14 at 08:44 -0700, Stephen Hemminger wrote:
> >
> > > memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
> > >
> > > - hdr = (struct mld_msg *) skb_put(skb, sizeof(struct
> > > mld_msg));
> > > - memset(hdr, 0, sizeof(struct mld_msg));
> > > + hdr = (struct mld_msg *) skb_put_zero(skb, sizeof(struct
> > > mld_msg));
> >
> > Why does skb_put_zero return char * instead of void *?
> > If returned void * it would save having to add lots of casts.
> >
> > One could even go farther by making skb_put_zero a macro and
> > use typeof().
>
> I just copied it from skb_put() - you could ask the same there? :)
My taste is to have less casts. Never understood why so many skb_
functions returned char *, probably a leftover from older Unix style.
Powered by blists - more mailing lists