mm/mm_heap: do this check in mm_size2ndx
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
ac8918345b
commit
a161800214
@ -147,20 +147,9 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||||||
|
|
||||||
DEBUGVERIFY(mm_lock(heap));
|
DEBUGVERIFY(mm_lock(heap));
|
||||||
|
|
||||||
/* Get the location in the node list to start the search. Special case
|
/* Convert the request size into a nodelist index */
|
||||||
* really big allocations
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (alignsize >= MM_MAX_CHUNK)
|
ndx = mm_size2ndx(alignsize);
|
||||||
{
|
|
||||||
ndx = MM_NNODES - 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Convert the request size into a nodelist index */
|
|
||||||
|
|
||||||
ndx = mm_size2ndx(alignsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Search for a large enough chunk in the list of nodes. This list is
|
/* Search for a large enough chunk in the list of nodes. This list is
|
||||||
* ordered by size, but will have occasional zero sized nodes as we visit
|
* ordered by size, but will have occasional zero sized nodes as we visit
|
||||||
|
Loading…
Reference in New Issue
Block a user