mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-30 15:15:05 +00:00
stats: Move memp_names table out of stats_init/stats_display_memp functions
This makes the code simpler with better readability. Also make memp_names static because it's only referenced by stats.c. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
70ebeda7ed
commit
c221361874
@ -49,15 +49,18 @@
|
||||
|
||||
struct stats_ lwip_stats;
|
||||
|
||||
#if MEMP_STATS
|
||||
static const char * memp_names[] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
||||
#include "lwip/priv/memp_std.h"
|
||||
};
|
||||
#endif /* MEMP_STATS */
|
||||
|
||||
void
|
||||
stats_init(void)
|
||||
{
|
||||
#ifdef LWIP_DEBUG
|
||||
#if MEMP_STATS
|
||||
const char * memp_names[] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
||||
#include "lwip/priv/memp_std.h"
|
||||
};
|
||||
int i;
|
||||
for (i = 0; i < MEMP_MAX; i++) {
|
||||
lwip_stats.memp[i].name = memp_names[i];
|
||||
@ -125,10 +128,6 @@ stats_display_mem(struct stats_mem *mem, const char *name)
|
||||
void
|
||||
stats_display_memp(struct stats_mem *mem, int index)
|
||||
{
|
||||
const char * memp_names[] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
||||
#include "lwip/priv/memp_std.h"
|
||||
};
|
||||
if (index < MEMP_MAX) {
|
||||
stats_display_mem(mem, memp_names[index]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user