From 33d0096b8163711a58c62b2b52d8f01df4fb584c Mon Sep 17 00:00:00 2001 From: jani Date: Thu, 26 Feb 2004 10:43:09 +0000 Subject: [PATCH] add switch for MEMP_SANITY_CHECK defaulting to off --- src/core/memp.c | 6 ++++-- src/include/lwip/opt.h | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/memp.c b/src/core/memp.c index 8e406659..c570b7e1 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -120,7 +120,7 @@ static u8_t memp_memory[(MEMP_NUM_PBUF * static sys_sem_t mutex; #endif -#ifndef LWIP_NOASSERT +#if MEMP_SANITY_CHECK static int memp_sanity(void) { @@ -140,7 +140,7 @@ memp_sanity(void) } return 1; } -#endif /* LWIP_DEBUG */ +#endif /* MEMP_SANITY_CHECK*/ void memp_init(void) @@ -261,7 +261,9 @@ memp_free(memp_t type, void *mem) memp->next = memp_tab[type]; memp_tab[type] = memp; +#if MEMP_SANITY_CHECK LWIP_ASSERT("memp sanity", memp_sanity()); +#endif #if SYS_LIGHTWEIGHT_PROT SYS_ARCH_UNPROTECT(old_level); diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 240ae6bd..31dcb0cb 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -67,6 +67,10 @@ a lot of data that needs to be copied, this should be set high. */ #define MEM_SIZE 1600 #endif +#ifndef MEMP_SANITY_CHECK +#define MEMP_SANITY_CHECK 0 +#endif + /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application sends a lot of data out of ROM (or other static memory), this should be set high. */