mm/heap: Add FAR to the pointer type
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
10e3d28372
commit
473bacd7a2
@ -91,7 +91,7 @@
|
|||||||
#define MM_MAX_CHUNK (1 << MM_MAX_SHIFT)
|
#define MM_MAX_CHUNK (1 << MM_MAX_SHIFT)
|
||||||
#define MM_NNODES (MM_MAX_SHIFT - MM_MIN_SHIFT + 1)
|
#define MM_NNODES (MM_MAX_SHIFT - MM_MIN_SHIFT + 1)
|
||||||
|
|
||||||
#define MM_GRAN_MASK (MM_MIN_CHUNK-1)
|
#define MM_GRAN_MASK (MM_MIN_CHUNK - 1)
|
||||||
#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK)
|
#define MM_ALIGN_UP(a) (((a) + MM_GRAN_MASK) & ~MM_GRAN_MASK)
|
||||||
#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK)
|
#define MM_ALIGN_DOWN(a) ((a) & ~MM_GRAN_MASK)
|
||||||
|
|
||||||
@ -105,7 +105,7 @@
|
|||||||
# define MM_ALLOC_BIT 0x80000000
|
# define MM_ALLOC_BIT 0x80000000
|
||||||
#endif
|
#endif
|
||||||
#define MM_IS_ALLOCATED(n) \
|
#define MM_IS_ALLOCATED(n) \
|
||||||
((int)((struct mm_allocnode_s*)(n)->preceding) < 0)
|
((int)((FAR struct mm_allocnode_s *)(n)->preceding) < 0)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
@ -155,7 +155,7 @@ struct mm_freenode_s
|
|||||||
|
|
||||||
struct mm_delaynode_s
|
struct mm_delaynode_s
|
||||||
{
|
{
|
||||||
struct mm_delaynode_s *flink;
|
FAR struct mm_delaynode_s *flink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* What is the size of the freenode? */
|
/* What is the size of the freenode? */
|
||||||
@ -200,7 +200,7 @@ struct mm_heap_impl_s
|
|||||||
|
|
||||||
/* Free delay list, for some situation can't do free immdiately */
|
/* Free delay list, for some situation can't do free immdiately */
|
||||||
|
|
||||||
struct mm_delaynode_s *mm_delaylist;
|
FAR struct mm_delaynode_s *mm_delaylist;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Functions contained in mm_shrinkchunk.c **********************************/
|
/* Functions contained in mm_shrinkchunk.c **********************************/
|
||||||
|
@ -104,7 +104,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||||||
FAR struct mm_heap_impl_s *heap_impl;
|
FAR struct mm_heap_impl_s *heap_impl;
|
||||||
FAR struct mm_freenode_s *node;
|
FAR struct mm_freenode_s *node;
|
||||||
size_t alignsize;
|
size_t alignsize;
|
||||||
void *ret = NULL;
|
FAR void *ret = NULL;
|
||||||
int ndx;
|
int ndx;
|
||||||
|
|
||||||
DEBUGASSERT(MM_IS_VALID(heap));
|
DEBUGASSERT(MM_IS_VALID(heap));
|
||||||
@ -224,7 +224,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
|
|||||||
/* Handle the case of an exact size match */
|
/* Handle the case of an exact size match */
|
||||||
|
|
||||||
node->preceding |= MM_ALLOC_BIT;
|
node->preceding |= MM_ALLOC_BIT;
|
||||||
ret = (void *)((FAR char *)node + SIZEOF_MM_ALLOCNODE);
|
ret = (FAR void *)((FAR char *)node + SIZEOF_MM_ALLOCNODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUGASSERT(ret == NULL || mm_heapmember(heap, ret));
|
DEBUGASSERT(ret == NULL || mm_heapmember(heap, ret));
|
||||||
|
Loading…
Reference in New Issue
Block a user