Skip to content
Snippets Groups Projects
Commit af2c1538 authored by Lucas Jenß's avatar Lucas Jenß Committed by GitHub
Browse files

Merge pull request #6249 from smlng/pr/gnrc/netif_hdr/fix_cppcheck

cppcheck: grnc/netif/hdr fix cppcheck warnings
parents 35c42209 645ea902
No related branches found
No related tags found
No related merge requests found
......@@ -40,59 +40,43 @@ gnrc_pktsnip_t *gnrc_netif_hdr_build(uint8_t *src, uint8_t src_len, uint8_t *dst
uint8_t gnrc_netif_hdr_get_flag(gnrc_pktsnip_t* pkt)
{
gnrc_netif_hdr_t* netif_hdr;
assert(pkt != NULL);
pkt = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_NETIF);
if (pkt) {
netif_hdr = pkt->data;
if (netif_hdr) {
return netif_hdr->flags;
}
if (pkt && pkt->data) {
gnrc_netif_hdr_t *netif_hdr = pkt->data;
return netif_hdr->flags;
}
return 0U;
}
int gnrc_netif_hdr_get_dstaddr(gnrc_pktsnip_t* pkt, uint8_t** pointer_to_addr)
{
int res;
gnrc_netif_hdr_t* netif_hdr;
assert(pkt != NULL);
pkt = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_NETIF);
if (pkt) {
netif_hdr = pkt->data;
if (netif_hdr) {
if ((res = netif_hdr->dst_l2addr_len) <= 0) {
return -ENOENT;
}
if (pkt && pkt->data) {
gnrc_netif_hdr_t *netif_hdr = pkt->data;
if (netif_hdr->dst_l2addr_len > 0) {
*pointer_to_addr = gnrc_netif_hdr_get_dst_addr(netif_hdr);
return res;
return netif_hdr->dst_l2addr_len;
}
}
return -ENOENT;
}
int gnrc_netif_hdr_get_srcaddr(gnrc_pktsnip_t* pkt, uint8_t** pointer_to_addr)
{
int res;
gnrc_netif_hdr_t* netif_hdr;
assert(pkt != NULL);
pkt = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_NETIF);
if (pkt) {
netif_hdr = pkt->data;
if (netif_hdr) {
if ((res = netif_hdr->src_l2addr_len) <= 0) {
return -ENOENT;
}
if (pkt && pkt->data) {
gnrc_netif_hdr_t *netif_hdr = pkt->data;
if (netif_hdr->src_l2addr_len > 0) {
*pointer_to_addr = gnrc_netif_hdr_get_src_addr(netif_hdr);
return res;
return netif_hdr->src_l2addr_len;
}
}
return -ENOENT;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment