tcpip_priv.h: More flexible API by including return value in API_VAR_ALLOC macro

This commit is contained in:
Dirk Ziegelmeier
2016-04-25 21:00:28 +02:00
parent 0d0b935d3d
commit 5a123a3405
4 changed files with 8 additions and 8 deletions

View File

@@ -50,16 +50,16 @@ struct netif;
#if LWIP_MPU_COMPATIBLE
#define API_VAR_REF(name) (*(name))
#define API_VAR_DECLARE(type, name) type * name
#define API_VAR_ALLOC(type, pool, name) do { \
#define API_VAR_ALLOC(type, pool, name, errorval) do { \
name = (type *)memp_malloc(pool); \
if (name == NULL) { \
return ERR_MEM; \
return errorval; \
} \
} while(0)
#define API_VAR_ALLOC_POOL(type, pool, name) do { \
#define API_VAR_ALLOC_POOL(type, pool, name, errorval) do { \
name = (type *)LWIP_MEMPOOL_ALLOC(pool); \
if (name == NULL) { \
return ERR_MEM; \
return errorval; \
} \
} while(0)
#define API_VAR_ALLOC_DONTFAIL(type, pool, name) do { \