提交 b8677f44 编写于 作者: B bernard.xiong

fix memp.c compiling error when DEBUG option is open.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@315 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 4c56e269
......@@ -125,6 +125,14 @@ const u16_t memp_sizes[MEMP_MAX] = {
#define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEM_ALIGN_SIZE(size),
#include "lwip/memp_std.h"
};
/** This array holds a textual description of each pool. */
#ifdef LWIP_DEBUG
static const char *memp_desc[MEMP_MAX] = {
#define LWIP_MEMPOOL(name,num,size,desc) (desc),
#include "lwip/memp_std.h"
};
#endif /* LWIP_DEBUG */
#if !MEMP_MEM_MALLOC /* don't build if not configured for use in lwipopts.h */
......@@ -134,14 +142,6 @@ static const u16_t memp_num[MEMP_MAX] = {
#include "lwip/memp_std.h"
};
/** This array holds a textual description of each pool. */
#ifdef LWIP_DEBUG
static const char *memp_desc[MEMP_MAX] = {
#define LWIP_MEMPOOL(name,num,size,desc) (desc),
#include "lwip/memp_std.h"
};
#endif /* LWIP_DEBUG */
/** This is the actual memory used by the pools. */
static u8_t memp_memory[MEM_ALIGNMENT - 1
#define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) )
......@@ -347,8 +347,8 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
#else
void* ptr;
rt_uint32_t size;
SYS_ARCH_DECL_PROTECT(old_level);
SYS_ARCH_DECL_PROTECT(old_level);
size = memp_sizes[type];
LWIP_DEBUGF(MEMP_DEBUG, ("memp malloc %s, size %d, ", memp_desc[type], memp_sizes[type]));
......@@ -366,8 +366,8 @@ memp_malloc_fn(memp_t type, const char* file, const int line)
tcp_pcbs ++;
}
}
SYS_ARCH_UNPROTECT(old_level);
SYS_ARCH_UNPROTECT(old_level);
ptr = mem_malloc(size);
LWIP_DEBUGF(MEMP_DEBUG, ("mem 0x%x\n", ptr));
......@@ -416,18 +416,18 @@ memp_free(memp_t type, void *mem)
SYS_ARCH_UNPROTECT(old_level);
#else
SYS_ARCH_DECL_PROTECT(old_level);
SYS_ARCH_DECL_PROTECT(old_level);
SYS_ARCH_PROTECT(old_level);
if (type == MEMP_TCP_PCB && mem)
{
tcp_pcbs --;
}
SYS_ARCH_UNPROTECT(old_level);
SYS_ARCH_UNPROTECT(old_level);
LWIP_DEBUGF(MEMP_DEBUG, ("memp free %s, mem 0x%x\n", memp_desc[type], mem));
/* release this memory */
mem_free(mem);
#endif /* MEMP_MEM_MALLOC */
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册