Skip to content

Commit

Permalink
gnrc_pktbuf: drop gnrc_pktbuf_replace_snip()
Browse files Browse the repository at this point in the history
The function was deprecated in e94aa40
and is unused and untested in the current code base.
  • Loading branch information
miri64 committed Oct 29, 2020
1 parent 9e4dd8e commit 72821a5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
17 changes: 0 additions & 17 deletions sys/include/net/gnrc/pktbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,6 @@ gnrc_pktsnip_t *gnrc_pktbuf_start_write(gnrc_pktsnip_t *pkt);
*/
gnrc_pktsnip_t *gnrc_pktbuf_remove_snip(gnrc_pktsnip_t *pkt, gnrc_pktsnip_t *snip);

/**
* @brief Replace a snip from a packet and the packet buffer by another snip.
*
* @deprecated Function is not used by anyone (not even tested, see
* https://github.com/RIOT-OS/RIOT/issues/5089). Will be removed
* after 2020.10 release.
*
* @param[in] pkt A packet
* @param[in] old snip currently in the packet
* @param[in] add snip which will replace old
*
* @return The new reference to @p pkt
*/
gnrc_pktsnip_t *gnrc_pktbuf_replace_snip(gnrc_pktsnip_t *pkt,
gnrc_pktsnip_t *old,
gnrc_pktsnip_t *add);

/**
* @brief Reverses snip order of a packet in a write-protected manner.
*
Expand Down
25 changes: 0 additions & 25 deletions sys/net/gnrc/pktbuf/gnrc_pktbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@ gnrc_pktsnip_t *gnrc_pktbuf_remove_snip(gnrc_pktsnip_t *pkt,
return pkt;
}

gnrc_pktsnip_t *gnrc_pktbuf_replace_snip(gnrc_pktsnip_t *pkt,
gnrc_pktsnip_t *old,
gnrc_pktsnip_t *add)
{
/* If add is a list we need to preserve its tail */
if (add->next != NULL) {
gnrc_pktsnip_t *tail = add->next;
/* find the last snip in tail */
gnrc_pktsnip_t *back = gnrc_pkt_prev_snip(tail, NULL);
/* Replace old */
LL_REPLACE_ELEM(pkt, old, add);
/* and wire in the tail between */
back->next = add->next;
add->next = tail;
}
else {
/* add is a single element, has no tail, simply replace */
LL_REPLACE_ELEM(pkt, old, add);
}
old->next = NULL;
gnrc_pktbuf_release(old);

return pkt;
}

gnrc_pktsnip_t *gnrc_pktbuf_reverse_snips(gnrc_pktsnip_t *pkt)
{
gnrc_pktsnip_t *reversed = NULL, *ptr = pkt;
Expand Down

0 comments on commit 72821a5

Please sign in to comment.