mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-11 15:40:05 +00:00
memp: Fix unused variable build error when MEMP_SANITY_REGION_BEFORE/AFTER is 0
MEMP_SANITY_REGION_BEFORE and MEMP_SANITY_REGION_AFTER can be overridden in lwipopts.h, if one of it is set to 0 we got build error due to unused variable. Fix unused variable build error when MEMP_OVERFLOW_CHECK >= 1 && (MEMP_SANITY_REGION_BEFORE == 0 || MEMP_SANITY_REGION_AFTER == 0). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
parent
730080f20e
commit
b3bae1b44c
@ -124,9 +124,9 @@ memp_sanity(const struct memp_desc *desc)
|
|||||||
static void
|
static void
|
||||||
memp_overflow_check_element_overflow(struct memp *p, const struct memp_desc *desc)
|
memp_overflow_check_element_overflow(struct memp *p, const struct memp_desc *desc)
|
||||||
{
|
{
|
||||||
|
#if MEMP_SANITY_REGION_AFTER_ALIGNED > 0
|
||||||
u16_t k;
|
u16_t k;
|
||||||
u8_t *m;
|
u8_t *m;
|
||||||
#if MEMP_SANITY_REGION_AFTER_ALIGNED > 0
|
|
||||||
m = (u8_t*)p + MEMP_SIZE + desc->size;
|
m = (u8_t*)p + MEMP_SIZE + desc->size;
|
||||||
for (k = 0; k < MEMP_SANITY_REGION_AFTER_ALIGNED; k++) {
|
for (k = 0; k < MEMP_SANITY_REGION_AFTER_ALIGNED; k++) {
|
||||||
if (m[k] != 0xcd) {
|
if (m[k] != 0xcd) {
|
||||||
@ -135,7 +135,10 @@ memp_overflow_check_element_overflow(struct memp *p, const struct memp_desc *des
|
|||||||
LWIP_ASSERT(errstr, 0);
|
LWIP_ASSERT(errstr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else /* MEMP_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||||
|
LWIP_UNUSED_ARG(p);
|
||||||
|
LWIP_UNUSED_ARG(desc);
|
||||||
|
#endif /* MEMP_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,9 +151,9 @@ memp_overflow_check_element_overflow(struct memp *p, const struct memp_desc *des
|
|||||||
static void
|
static void
|
||||||
memp_overflow_check_element_underflow(struct memp *p, const struct memp_desc *desc)
|
memp_overflow_check_element_underflow(struct memp *p, const struct memp_desc *desc)
|
||||||
{
|
{
|
||||||
|
#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0
|
||||||
u16_t k;
|
u16_t k;
|
||||||
u8_t *m;
|
u8_t *m;
|
||||||
#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0
|
|
||||||
m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED;
|
m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED;
|
||||||
for (k = 0; k < MEMP_SANITY_REGION_BEFORE_ALIGNED; k++) {
|
for (k = 0; k < MEMP_SANITY_REGION_BEFORE_ALIGNED; k++) {
|
||||||
if (m[k] != 0xcd) {
|
if (m[k] != 0xcd) {
|
||||||
@ -159,7 +162,10 @@ memp_overflow_check_element_underflow(struct memp *p, const struct memp_desc *de
|
|||||||
LWIP_ASSERT(errstr, 0);
|
LWIP_ASSERT(errstr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else /* MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 */
|
||||||
|
LWIP_UNUSED_ARG(p);
|
||||||
|
LWIP_UNUSED_ARG(desc);
|
||||||
|
#endif /* MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +174,7 @@ memp_overflow_check_element_underflow(struct memp *p, const struct memp_desc *de
|
|||||||
static void
|
static void
|
||||||
memp_overflow_init_element(struct memp *p, const struct memp_desc *desc)
|
memp_overflow_init_element(struct memp *p, const struct memp_desc *desc)
|
||||||
{
|
{
|
||||||
|
#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 || MEMP_SANITY_REGION_AFTER_ALIGNED > 0
|
||||||
u8_t *m;
|
u8_t *m;
|
||||||
#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0
|
#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0
|
||||||
m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED;
|
m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED;
|
||||||
@ -177,6 +184,10 @@ memp_overflow_init_element(struct memp *p, const struct memp_desc *desc)
|
|||||||
m = (u8_t*)p + MEMP_SIZE + desc->size;
|
m = (u8_t*)p + MEMP_SIZE + desc->size;
|
||||||
memset(m, 0xcd, MEMP_SANITY_REGION_AFTER_ALIGNED);
|
memset(m, 0xcd, MEMP_SANITY_REGION_AFTER_ALIGNED);
|
||||||
#endif
|
#endif
|
||||||
|
#else /* MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 || MEMP_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||||
|
LWIP_UNUSED_ARG(p);
|
||||||
|
LWIP_UNUSED_ARG(desc);
|
||||||
|
#endif /* MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 || MEMP_SANITY_REGION_AFTER_ALIGNED > 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MEMP_OVERFLOW_CHECK >= 2
|
#if MEMP_OVERFLOW_CHECK >= 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user