mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-09 09:47:11 +00:00
zebra: Delay the usage of one variable until need
In the loop, local variable `ip` is always set even if the check condition is not satisfied. Avoid the redundant set, move this set exactly after the check condition is satisfied. Set `ip` only if the check condition is met, otherwise needn't. Signed-off-by: anlan_cs <vic.lan@pica8.com>
This commit is contained in:
parent
2821405a69
commit
38eda16a24
@ -344,10 +344,10 @@ int zebra_evpn_add_macip_for_intf(struct interface *ifp,
|
|||||||
for (ALL_LIST_ELEMENTS(ifp->connected, cnode, cnnode, c)) {
|
for (ALL_LIST_ELEMENTS(ifp->connected, cnode, cnnode, c)) {
|
||||||
struct ipaddr ip;
|
struct ipaddr ip;
|
||||||
|
|
||||||
memset(&ip, 0, sizeof(struct ipaddr));
|
|
||||||
if (!CHECK_FLAG(c->conf, ZEBRA_IFC_REAL))
|
if (!CHECK_FLAG(c->conf, ZEBRA_IFC_REAL))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
memset(&ip, 0, sizeof(struct ipaddr));
|
||||||
if (c->address->family == AF_INET) {
|
if (c->address->family == AF_INET) {
|
||||||
ip.ipa_type = IPADDR_V4;
|
ip.ipa_type = IPADDR_V4;
|
||||||
memcpy(&(ip.ipaddr_v4), &(c->address->u.prefix4),
|
memcpy(&(ip.ipaddr_v4), &(c->address->u.prefix4),
|
||||||
|
Loading…
Reference in New Issue
Block a user