MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_realloc

Function rt_realloc

src/kservice.c:880–896  ·  view source on GitHub ↗

* @brief This function will change the size of previously allocated memory block. * * @param ptr is the pointer to memory allocated by rt_malloc. * * @param newsize is the required new size. * * @return the changed memory block address. */

Source from the content-addressed store, hash-verified

878 * @return the changed memory block address.
879 */
880rt_weak void *rt_realloc(void *ptr, rt_size_t newsize)
881{
882 rt_base_t level;
883 void *nptr;
884
885 /* Entry hook */
886 RT_OBJECT_HOOK_CALL(rt_realloc_entry_hook, (&ptr, newsize));
887 /* Enter critical zone */
888 level = _heap_lock();
889 /* Change the size of previously allocated memory block */
890 nptr = _MEM_REALLOC(ptr, newsize);
891 /* Exit critical zone */
892 _heap_unlock(level);
893 /* Exit hook */
894 RT_OBJECT_HOOK_CALL(rt_realloc_exit_hook, (&nptr, newsize));
895 return nptr;
896}
897RTM_EXPORT(rt_realloc);
898
899/**

Callers 15

fal_partition_initFunction · 0.85
_strvec_appendFunction · 0.85
args_appendFunction · 0.85
ofw_phandle_hash_resetFunction · 0.85
rt_wlan_cfg_saveFunction · 0.85
utest_initFunction · 0.85
reallocFunction · 0.85
reallocFunction · 0.85
reallocFunction · 0.85
_realloc_rFunction · 0.85

Calls 2

_heap_lockFunction · 0.85
_heap_unlockFunction · 0.85

Tested by 1

utest_initFunction · 0.68