Hi Werner, On Thu, Aug 08, 2013 at 09:45:45PM +0200, Alexander Aring wrote: > Hi Werner, > > On Thu, Aug 08, 2013 at 03:10:07PM -0300, Werner Almesberger wrote: > > Alexander Aring wrote: > > > static inline int lowpan_fetch_skb(struct sk_buff *skb, > > > > Looks nice. It's not terribly efficient to check the length each time, > > but then 6LoWPAN isn't meant to be a speed demon :-) Since you have a > > lot of long sequences of such operations, maybe don't return an errno > > code here but just a bool. Then you can > > > > bool fail; > > > > ... > > fail = lowpan_fetch_skb(skb, d, 2); > > fail |= lowpan_fetch_skb(skb, d, 2); > > break; > > ... > > if (fail) > > return -EINVAL; > > ... > > > nice, Ok I will try that. Thanks. > I think we can't do this... because we need to go out if we got some fail. In this version we check fail after a break.
So the first fail failed and then we check the others which also fails. It's not a problem, I mean... we should check it after each call. What is if we can only pull 2 bytes from a skb: fail = lowpan_fetch_skb(skb, d, 4); <-- fails fail |= lowpan_fetch_skb(skb, d, 2); <-- not fails and has pulled But we run in this case in a error state that's true... This version is nice for have smaller C code, but not so nice for functionality. Nevertheless I will do it so. - Alex ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel