tcpip: guard tcpip_msg enum/struct member with !CORE_LOCKING

enum tcpip_msg_type and struct tcpip_msg have members which are only
used when core locking and/or core locking input are disabled. Remove
these from the union to reduce the size. Remove from enum to prevent
usage when these are options are disabled

A quick sizeof test with MSVC 2013 showed a 4 byte size reduction for
struct tcpip_msg (16 bytes -> 12bytes) for the following configuration:
  LWIP_TCPIP_CORE_LOCKING        1
  LWIP_TCPIP_CORE_LOCKING_INPUT  1
  LWIP_TCPIP_TIMEOUT             0
This commit is contained in:
Joel Cunningham 2018-02-05 17:30:00 -06:00
parent f7be3d10ae
commit d785561eae

View File

@ -111,9 +111,13 @@ typedef err_t (*tcpip_api_call_fn)(struct tcpip_api_call_data* call);
err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call); err_t tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call);
enum tcpip_msg_type { enum tcpip_msg_type {
#if !LWIP_TCPIP_CORE_LOCKING
TCPIP_MSG_API, TCPIP_MSG_API,
TCPIP_MSG_API_CALL, TCPIP_MSG_API_CALL,
#endif /* !LWIP_TCPIP_CORE_LOCKING */
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
TCPIP_MSG_INPKT, TCPIP_MSG_INPKT,
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
#if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS #if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
TCPIP_MSG_TIMEOUT, TCPIP_MSG_TIMEOUT,
TCPIP_MSG_UNTIMEOUT, TCPIP_MSG_UNTIMEOUT,
@ -125,6 +129,7 @@ enum tcpip_msg_type {
struct tcpip_msg { struct tcpip_msg {
enum tcpip_msg_type type; enum tcpip_msg_type type;
union { union {
#if !LWIP_TCPIP_CORE_LOCKING
struct { struct {
tcpip_callback_fn function; tcpip_callback_fn function;
void* msg; void* msg;
@ -134,11 +139,14 @@ struct tcpip_msg {
struct tcpip_api_call_data *arg; struct tcpip_api_call_data *arg;
sys_sem_t *sem; sys_sem_t *sem;
} api_call; } api_call;
#endif /* LWIP_TCPIP_CORE_LOCKING */
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
struct { struct {
struct pbuf *p; struct pbuf *p;
struct netif *netif; struct netif *netif;
netif_input_fn input_fn; netif_input_fn input_fn;
} inp; } inp;
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
struct { struct {
tcpip_callback_fn function; tcpip_callback_fn function;
void *ctx; void *ctx;