Skip to content

Commit

Permalink
net: skb_peek()/skb_peek_tail() cleanups
Browse files Browse the repository at this point in the history
remove useless casts and rename variables for less confusion.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed May 1, 2012
1 parent e4cbb02 commit 18d0700
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
*/
static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
{
struct sk_buff *list = ((const struct sk_buff *)list_)->next;
if (list == (struct sk_buff *)list_)
list = NULL;
return list;
struct sk_buff *skb = list_->next;

if (skb == (struct sk_buff *)list_)
skb = NULL;
return skb;
}

/**
Expand All @@ -902,6 +903,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
const struct sk_buff_head *list_)
{
struct sk_buff *next = skb->next;

if (next == (struct sk_buff *)list_)
next = NULL;
return next;
Expand All @@ -922,10 +924,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
*/
static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
{
struct sk_buff *list = ((const struct sk_buff *)list_)->prev;
if (list == (struct sk_buff *)list_)
list = NULL;
return list;
struct sk_buff *skb = list_->prev;

if (skb == (struct sk_buff *)list_)
skb = NULL;
return skb;

}

/**
Expand Down

0 comments on commit 18d0700

Please sign in to comment.