Moved static variable from inside the function to global scope

This commit is contained in:
goldsimon 2011-06-07 19:10:55 +00:00 committed by goldsimon
parent 8d74559f72
commit 717b2dab59
2 changed files with 8 additions and 4 deletions

View File

@ -126,6 +126,11 @@ u32_t dhcp_rx_options_val[DHCP_OPTION_IDX_MAX];
@todo: move this into struct dhcp? */
u8_t dhcp_rx_options_given[DHCP_OPTION_IDX_MAX];
#ifdef DHCP_GLOBAL_XID
static u32_t xid;
static u8_t xid_initialised;
#endif /* DHCP_GLOBAL_XID */
#define dhcp_option_given(dhcp, idx) (dhcp_rx_options_given[idx] != 0)
#define dhcp_got_option(dhcp, idx) (dhcp_rx_options_given[idx] = 1)
#define dhcp_clear_option(dhcp, idx) (dhcp_rx_options_given[idx] = 0)
@ -1628,8 +1633,6 @@ dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type)
* at runtime, any supporting function prototypes can be defined in DHCP_GLOBAL_XID_HEADER */
static u32_t xid = 0xABCD0000;
#else
static u32_t xid;
static u8_t xid_initialised = 0;
if (!xid_initialised) {
xid = DHCP_GLOBAL_XID;
xid_initialised = !xid_initialised;

View File

@ -75,6 +75,8 @@
struct netif *netif_list;
struct netif *netif_default;
static u8_t netif_num;
#if LWIP_HAVE_LOOPIF
static struct netif loop_netif;
@ -137,7 +139,6 @@ struct netif *
netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input)
{
static u8_t netifnum = 0;
LWIP_ASSERT("No init function given", init != NULL);
@ -170,7 +171,7 @@ netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask,
/* remember netif specific state information data */
netif->state = state;
netif->num = netifnum++;
netif->num = netif_num++;
netif->input = input;
#if LWIP_NETIF_HWADDRHINT
netif->addr_hint = NULL;