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

Function _alloc_memreg

components/mm/mm_memblock.c:63–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63static struct rt_mmblk_reg *_alloc_memreg(struct rt_mmblk_reg *prev)
64{
65 for (int i =_hint_idx; i < RT_INIT_MEMORY_REGIONS; i++)
66 {
67 if (_regions[i].alloc == RT_FALSE)
68 {
69 rt_slist_insert(&(prev->node), &(_regions[i].node));
70 _regions[i].alloc = RT_TRUE;
71 _hint_idx = i + 1;
72 return &_regions[i];
73 }
74 }
75
76 for (int i = 0; i < _hint_idx; i++)
77 {
78 if (_regions[i].alloc == RT_FALSE)
79 {
80 rt_slist_insert(&(prev->node), &(_regions[i].node));
81 _regions[i].alloc = RT_TRUE;
82 _hint_idx = i + 1;
83 return &_regions[i];
84 }
85 }
86
87 return RT_NULL;
88}
89
90static void _free_memreg(struct rt_mmblk_reg *prev)
91{

Callers 1

_reg_insert_afterFunction · 0.85

Calls 1

rt_slist_insertFunction · 0.85

Tested by

no test coverage detected