From 869ce92246ca629b9c2306a6de783cbd6c99f948 Mon Sep 17 00:00:00 2001 From: Joakim Gebart Date: Mon, 18 May 2015 06:34:13 +0200 Subject: [PATCH] ng_ndp: reduce scope of variables l2src, l2src_len Fixes cppcheck warnings: sys/net/network_layer/ng_ndp/ng_ndp.c:548: style (variableScope): The scope of the variable 'l2src' can be reduced. sys/net/network_layer/ng_ndp/ng_ndp.c:549: style (variableScope): The scope of the variable 'l2src_len' can be reduced. sys/net/network_layer/ng_ndp/ng_ndp.c:608: style (variableScope): The scope of the variable 'l2src' can be reduced. sys/net/network_layer/ng_ndp/ng_ndp.c:609: style (variableScope): The scope of the variable 'l2src_len' can be reduced. --- sys/net/network_layer/ng_ndp/ng_ndp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/network_layer/ng_ndp/ng_ndp.c b/sys/net/network_layer/ng_ndp/ng_ndp.c index 64f68a3ca5..1f529e7db6 100644 --- a/sys/net/network_layer/ng_ndp/ng_ndp.c +++ b/sys/net/network_layer/ng_ndp/ng_ndp.c @@ -545,11 +545,11 @@ static void _send_nbr_sol(kernel_pid_t iface, ng_ipv6_addr_t *tgt, ng_pktsnip_t *hdr, *pkt = NULL; ng_ipv6_addr_t *src = NULL; size_t src_len = 0; - uint8_t l2src[8]; - uint16_t l2src_len; /* check if there is a fitting source address to target */ if ((src = ng_ipv6_netif_find_best_src_addr(iface, tgt)) != NULL) { + uint8_t l2src[8]; + uint16_t l2src_len; src_len = sizeof(ng_ipv6_addr_t); l2src_len = _get_l2src(l2src, sizeof(l2src), iface); @@ -605,8 +605,6 @@ static void _send_nbr_adv(kernel_pid_t iface, ng_ipv6_addr_t *tgt, ng_ipv6_addr_t *dst, bool supply_tl2a) { ng_pktsnip_t *hdr, *pkt = NULL; - uint8_t l2src[8]; - uint16_t l2src_len; uint8_t adv_flags = 0; if (ng_ipv6_netif_get(iface)->flags & NG_IPV6_NETIF_FLAGS_ROUTER) { @@ -622,6 +620,8 @@ static void _send_nbr_adv(kernel_pid_t iface, ng_ipv6_addr_t *tgt, } if (supply_tl2a) { + uint8_t l2src[8]; + uint16_t l2src_len; /* we previously checked if we are the target, so we can take our L2src */ l2src_len = _get_l2src(l2src, sizeof(l2src), iface);