mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 21:32:46 +00:00
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:
parent
5a12aeb4a1
commit
7f232b43ff
@ -125,6 +125,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ 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"
|
2007-05-03 "maq"
|
||||||
* sockets.c: Fix ioctl FIONREAD when some data remains from last recv.
|
* sockets.c: Fix ioctl FIONREAD when some data remains from last recv.
|
||||||
(patch #3574).
|
(patch #3574).
|
||||||
|
@ -165,7 +165,6 @@ void *
|
|||||||
memp_malloc(memp_t type)
|
memp_malloc(memp_t type)
|
||||||
{
|
{
|
||||||
struct memp *memp;
|
struct memp *memp;
|
||||||
void *mem;
|
|
||||||
#if SYS_LIGHTWEIGHT_PROT
|
#if SYS_LIGHTWEIGHT_PROT
|
||||||
SYS_ARCH_DECL_PROTECT(old_level);
|
SYS_ARCH_DECL_PROTECT(old_level);
|
||||||
#endif
|
#endif
|
||||||
@ -189,7 +188,6 @@ memp_malloc(memp_t type)
|
|||||||
lwip_stats.memp[type].max = lwip_stats.memp[type].used;
|
lwip_stats.memp[type].max = lwip_stats.memp[type].used;
|
||||||
}
|
}
|
||||||
#endif /* MEMP_STATS */
|
#endif /* MEMP_STATS */
|
||||||
mem = (u8_t *)memp + MEMP_SIZE;
|
|
||||||
LWIP_ASSERT("memp_malloc: memp properly aligned",
|
LWIP_ASSERT("memp_malloc: memp properly aligned",
|
||||||
((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
|
((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +195,6 @@ memp_malloc(memp_t type)
|
|||||||
#if MEMP_STATS
|
#if MEMP_STATS
|
||||||
++lwip_stats.memp[type].err;
|
++lwip_stats.memp[type].err;
|
||||||
#endif /* MEMP_STATS */
|
#endif /* MEMP_STATS */
|
||||||
mem = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SYS_LIGHTWEIGHT_PROT
|
#if SYS_LIGHTWEIGHT_PROT
|
||||||
@ -206,7 +203,7 @@ memp_malloc(memp_t type)
|
|||||||
sys_sem_signal(mutex);
|
sys_sem_signal(mutex);
|
||||||
#endif /* SYS_LIGHTWEIGHT_PROT */
|
#endif /* SYS_LIGHTWEIGHT_PROT */
|
||||||
|
|
||||||
return mem;
|
return (void*)memp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -220,8 +217,10 @@ memp_free(memp_t type, void *mem)
|
|||||||
if (mem == NULL) {
|
if (mem == NULL) {
|
||||||
return;
|
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
|
#if SYS_LIGHTWEIGHT_PROT
|
||||||
SYS_ARCH_PROTECT(old_level);
|
SYS_ARCH_PROTECT(old_level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user