mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Tiny code size improvement using goto instead of duplicating code
This commit is contained in:
parent
db259c3557
commit
b09b8a0ccc
@ -676,8 +676,7 @@ dhcp_inform(struct netif *netif)
|
|||||||
dhcp->pcb = udp_new();
|
dhcp->pcb = udp_new();
|
||||||
if (dhcp->pcb == NULL) {
|
if (dhcp->pcb == NULL) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 2, ("dhcp_inform(): could not obtain pcb"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | 2, ("dhcp_inform(): could not obtain pcb"));
|
||||||
mem_free((void *)dhcp);
|
goto free_dhcp_and_return;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
old_dhcp = netif->dhcp;
|
old_dhcp = netif->dhcp;
|
||||||
netif->dhcp = dhcp;
|
netif->dhcp = dhcp;
|
||||||
@ -709,8 +708,9 @@ dhcp_inform(struct netif *netif)
|
|||||||
|
|
||||||
udp_remove(dhcp->pcb);
|
udp_remove(dhcp->pcb);
|
||||||
dhcp->pcb = NULL;
|
dhcp->pcb = NULL;
|
||||||
mem_free((void *)dhcp);
|
|
||||||
netif->dhcp = old_dhcp;
|
netif->dhcp = old_dhcp;
|
||||||
|
free_dhcp_and_return:
|
||||||
|
mem_free((void *)dhcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle a possible change in the network configuration.
|
/** Handle a possible change in the network configuration.
|
||||||
|
Loading…
Reference in New Issue
Block a user