checked in patch #5913: in memp_malloc() we can return memp as mem to save a little RAM (next pointer of memp is not used while not in pool).

This commit is contained in:
goldsimon 2007-05-04 15:52:11 +00:00
parent 5a12aeb4a1
commit 7f232b43ff
2 changed files with 8 additions and 5 deletions

View File

@ -125,6 +125,10 @@ HISTORY
++ Bug fixes:
2007-05-04 Simon Goldschmidt
* memp.c: checked in patch #5913: in memp_malloc() we can return memp as mem
to save a little RAM (next pointer of memp is not used while not in pool).
2007-05-03 "maq"
* sockets.c: Fix ioctl FIONREAD when some data remains from last recv.
(patch #3574).

View File

@ -165,7 +165,6 @@ void *
memp_malloc(memp_t type)
{
struct memp *memp;
void *mem;
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_DECL_PROTECT(old_level);
#endif
@ -189,7 +188,6 @@ memp_malloc(memp_t type)
lwip_stats.memp[type].max = lwip_stats.memp[type].used;
}
#endif /* MEMP_STATS */
mem = (u8_t *)memp + MEMP_SIZE;
LWIP_ASSERT("memp_malloc: memp properly aligned",
((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
} else {
@ -197,7 +195,6 @@ memp_malloc(memp_t type)
#if MEMP_STATS
++lwip_stats.memp[type].err;
#endif /* MEMP_STATS */
mem = NULL;
}
#if SYS_LIGHTWEIGHT_PROT
@ -206,7 +203,7 @@ memp_malloc(memp_t type)
sys_sem_signal(mutex);
#endif /* SYS_LIGHTWEIGHT_PROT */
return mem;
return (void*)memp;
}
void
@ -220,8 +217,10 @@ memp_free(memp_t type, void *mem)
if (mem == NULL) {
return;
}
LWIP_ASSERT("memp_free: mem properly aligned",
((mem_ptr_t)mem % MEM_ALIGNMENT) == 0);
memp = (struct memp *)((u8_t *)mem - MEMP_SIZE);
memp = (struct memp *)mem;
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_PROTECT(old_level);