mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 21:14:09 +00:00
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:
parent
f7be3d10ae
commit
d785561eae
@ -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);
|
||||
|
||||
enum tcpip_msg_type {
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
TCPIP_MSG_API,
|
||||
TCPIP_MSG_API_CALL,
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
TCPIP_MSG_INPKT,
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
#if LWIP_TCPIP_TIMEOUT && LWIP_TIMERS
|
||||
TCPIP_MSG_TIMEOUT,
|
||||
TCPIP_MSG_UNTIMEOUT,
|
||||
@ -125,6 +129,7 @@ enum tcpip_msg_type {
|
||||
struct tcpip_msg {
|
||||
enum tcpip_msg_type type;
|
||||
union {
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
struct {
|
||||
tcpip_callback_fn function;
|
||||
void* msg;
|
||||
@ -134,11 +139,14 @@ struct tcpip_msg {
|
||||
struct tcpip_api_call_data *arg;
|
||||
sys_sem_t *sem;
|
||||
} api_call;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
struct {
|
||||
struct pbuf *p;
|
||||
struct netif *netif;
|
||||
netif_input_fn input_fn;
|
||||
} inp;
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
struct {
|
||||
tcpip_callback_fn function;
|
||||
void *ctx;
|
||||
|
Loading…
Reference in New Issue
Block a user