Thread (5 messages) 5 messages, 3 authors, 2017-06-14

Re: [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize code

flat view

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2017-06-14 19:01:36

On Wed, 2017-06-14 at 08:44 -0700, Stephen Hemminger wrote:
quoted
 	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? :)

No objection to changing it though.

johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help