Merge pull request #2804 from authmillenon/pktbuf/api/pktbuf_remove

pktbuf: add helper function to remove snips from packet
This commit is contained in:
Kaspar Schleiser 2015-04-14 12:30:14 +02:00
commit e9fb853a81

View File

@ -36,6 +36,7 @@
#include "cpu-conf.h"
#include "net/ng_pkt.h"
#include "net/ng_nettype.h"
#include "utlist.h"
#ifdef __cplusplus
extern "C" {
@ -166,6 +167,19 @@ void ng_pktbuf_release(ng_pktsnip_t *pkt);
*/
ng_pktsnip_t *ng_pktbuf_start_write(ng_pktsnip_t *pkt);
/**
* @brief Deletes a snip from a packet and the packet buffer.
*
* @param[in] pkt A packet.
* @param[in] snip A snip in the packet.
*/
static inline void ng_pktbuf_remove_snip(ng_pktsnip_t *pkt, ng_pktsnip_t *snip)
{
LL_DELETE(pkt, snip);
snip->next = NULL;
ng_pktbuf_release(snip);
}
#ifdef DEVELHELP
/**
* @brief Prints some statistics about the packet buffer to stdout.