mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
* mem.c, stats.c, mem.h: apply patch #6414 to avoid compiler errors
and/or warnings on some systems where mem_size_t and size_t differ.
This commit is contained in:
parent
2637f2ad3a
commit
30d4c243ec
@ -596,6 +596,10 @@ HISTORY
|
||||
|
||||
++ Bug fixes:
|
||||
|
||||
2008-03-04 Jonathan Larmour
|
||||
* mem.c, stats.c, mem.h: apply patch #6414 to avoid compiler errors
|
||||
and/or warnings on some systems where mem_size_t and size_t differ.
|
||||
|
||||
2008-03-04 Kieran Mansley (contributions by others)
|
||||
* Numerous small compiler error/warning fixes from contributions to
|
||||
mailing list after 1.3.0 release candidate made.
|
||||
|
@ -561,7 +561,7 @@ mem_malloc(mem_size_t size)
|
||||
* @param size size of the objects to allocate
|
||||
* @return pointer to allocated memory / NULL pointer if there is an error
|
||||
*/
|
||||
void *mem_calloc(size_t count, size_t size)
|
||||
void *mem_calloc(mem_size_t count, mem_size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
|
@ -87,10 +87,10 @@ void
|
||||
stats_display_mem(struct stats_mem *mem, char *name)
|
||||
{
|
||||
LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name));
|
||||
LWIP_PLATFORM_DIAG(("avail: %"MEM_SIZE_F"\n\t", mem->avail));
|
||||
LWIP_PLATFORM_DIAG(("used: %"MEM_SIZE_F"\n\t", mem->used));
|
||||
LWIP_PLATFORM_DIAG(("max: %"MEM_SIZE_F"\n\t", mem->max));
|
||||
LWIP_PLATFORM_DIAG(("err: %"MEM_SIZE_F"\n", mem->err));
|
||||
LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail));
|
||||
LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used));
|
||||
LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max));
|
||||
LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -38,18 +38,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MEM_SIZE would have to be aligned, but using 64000 here instead of
|
||||
* 65535 leaves some room for alignment...
|
||||
*/
|
||||
#if MEM_SIZE > 64000l
|
||||
typedef u32_t mem_size_t;
|
||||
#define MEM_SIZE_F U32_F
|
||||
#else
|
||||
typedef u16_t mem_size_t;
|
||||
#define MEM_SIZE_F U16_F
|
||||
#endif /* MEM_SIZE > 64000 */
|
||||
|
||||
#if MEM_LIBC_MALLOC
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
|
||||
typedef size_t mem_size_t;
|
||||
|
||||
/* aliases for C library malloc() */
|
||||
#define mem_init()
|
||||
/* in case C library malloc() needs extra protection,
|
||||
@ -68,6 +62,16 @@ typedef u16_t mem_size_t;
|
||||
#define mem_realloc(x, size) (x)
|
||||
#endif
|
||||
#else /* MEM_LIBC_MALLOC */
|
||||
|
||||
/* MEM_SIZE would have to be aligned, but using 64000 here instead of
|
||||
* 65535 leaves some room for alignment...
|
||||
*/
|
||||
#if MEM_SIZE > 64000l
|
||||
typedef u32_t mem_size_t;
|
||||
#else
|
||||
typedef u16_t mem_size_t;
|
||||
#endif /* MEM_SIZE > 64000 */
|
||||
|
||||
#if MEM_USE_POOLS
|
||||
/** mem_init is not used when using pools instead of a heap */
|
||||
#define mem_init()
|
||||
@ -80,7 +84,7 @@ void mem_init(void);
|
||||
void *mem_realloc(void *mem, mem_size_t size);
|
||||
#endif /* MEM_USE_POOLS */
|
||||
void *mem_malloc(mem_size_t size);
|
||||
void *mem_calloc(size_t count, size_t size);
|
||||
void *mem_calloc(mem_size_t count, mem_size_t size);
|
||||
void mem_free(void *mem);
|
||||
#endif /* MEM_LIBC_MALLOC */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user