Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,11 @@ void *rt_malloc(rt_size_t size)
rt_size_t ptr, ptr2;
struct heap_mem *mem, *mem2;

RT_DEBUG_NOT_IN_INTERRUPT;

if (size == 0)
return RT_NULL;

RT_DEBUG_NOT_IN_INTERRUPT;

if (size != RT_ALIGN(size, RT_ALIGN_SIZE))
RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d, but align to %d\n",
size, RT_ALIGN(size, RT_ALIGN_SIZE)));
Expand Down Expand Up @@ -513,8 +513,6 @@ void *rt_calloc(rt_size_t count, rt_size_t size)
{
void *p;

RT_DEBUG_NOT_IN_INTERRUPT;

/* allocate 'count' objects of size 'size' */
p = rt_malloc(count * size);

Expand All @@ -536,10 +534,11 @@ void rt_free(void *rmem)
{
struct heap_mem *mem;

RT_DEBUG_NOT_IN_INTERRUPT;

if (rmem == RT_NULL)
return;

RT_DEBUG_NOT_IN_INTERRUPT;

RT_ASSERT((((rt_uint32_t)rmem) & (RT_ALIGN_SIZE - 1)) == 0);
RT_ASSERT((rt_uint8_t *)rmem >= (rt_uint8_t *)heap_ptr &&
(rt_uint8_t *)rmem < (rt_uint8_t *)heap_end);
Expand Down