1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc: cleanup and corrections in gnrc_pkt

This commit is contained in:
smlng 2017-04-19 21:04:25 +02:00
parent 993ed203b5
commit d11754031a
2 changed files with 9 additions and 12 deletions

View File

@ -128,7 +128,7 @@ static inline size_t gnrc_pkt_len(gnrc_pktsnip_t *pkt)
{
size_t len = 0;
while (pkt) {
while (pkt != NULL) {
len += pkt->size;
pkt = pkt->next;
}
@ -148,7 +148,7 @@ static inline size_t gnrc_pkt_len_upto(gnrc_pktsnip_t *pkt, gnrc_nettype_t type)
{
size_t len = 0;
while (pkt) {
while (pkt != NULL) {
len += pkt->size;
if (pkt->type == type) {
@ -172,7 +172,7 @@ static inline size_t gnrc_pkt_count(const gnrc_pktsnip_t *pkt)
{
size_t count = 0;
while (pkt) {
while (pkt != NULL) {
++count;
pkt = pkt->next;
}

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Freie Universität Berlin
* 2017 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -11,22 +12,18 @@
*
* @file
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
* @author Sebastian Meiling <s@mlng.net>
*/
#include <assert.h>
#include "net/gnrc/pkt.h"
gnrc_pktsnip_t *gnrc_pktsnip_search_type(gnrc_pktsnip_t *ptr,
gnrc_pktsnip_t *gnrc_pktsnip_search_type(gnrc_pktsnip_t *pkt,
gnrc_nettype_t type)
{
while (ptr != NULL) {
if (ptr->type == type) {
return ptr;
}
ptr = ptr->next;
while ((pkt != NULL) && (pkt->type != type)) {
pkt = pkt->next;
}
return NULL;
return pkt;
}
/** @} */