Mic_chen

It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

1、components\libc\compilers\newlib

/* Memory routine */
void *
_malloc_r (struct _reent *ptr, size_t size)
{
	void* result;

	result = (void*)rt_malloc (size);
	if (result == RT_NULL)
	{
		ptr->_errno = ENOMEM;
	}

	return result;
}

void *
_realloc_r (struct _reent *ptr, void *old, size_t newlen)
{
	void* result;

	result = (void*)rt_realloc (old, newlen);
	if (result == RT_NULL)
	{
		ptr->_errno = ENOMEM;
	}

	return result;
}

void *_calloc_r (struct _reent *ptr, size_t size, size_t len)
{
	void* result;

	result = (void*)rt_calloc (size, len);
	if (result == RT_NULL)
	{
		ptr->_errno = ENOMEM;
	}

	return result;
}

void 
_free_r (struct _reent *ptr, void *addr)
{
	rt_free (addr);
}

  

2、components\libc\compilers\minilibc

void *malloc(size_t size)
{
	return rt_malloc(size);
}

void free(void *ptr)
{
	rt_free(ptr);
}

void *realloc(void *ptr, size_t size)
{
	return rt_realloc(ptr, size);
}

void *calloc(size_t nelem, size_t elsize)
{
	return rt_calloc(nelem, elsize);
}

  

 

posted on 2022-08-03 16:35  Mic_chen  阅读(112)  评论(0编辑  收藏  举报