mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
HV: code format for memory.c
replace blank space indent with tabs Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
d3e8c29d0e
commit
eb7cf14bcf
@ -108,7 +108,8 @@ static void *allocate_mem(struct mem_pool *pool, unsigned int num_bytes)
|
||||
}
|
||||
|
||||
/* Break if selected buffer is not free */
|
||||
if ((pool->bitmap[tmp_idx] & (1U << tmp_bit_idx)) != 0U)
|
||||
if ((pool->bitmap[tmp_idx]
|
||||
& (1U << tmp_bit_idx)) != 0U)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -121,7 +122,8 @@ static void *allocate_mem(struct mem_pool *pool, unsigned int num_bytes)
|
||||
* memory pool
|
||||
*/
|
||||
memory = (char *)pool->start_addr +
|
||||
pool->buff_size * (idx * BITMAP_WORD_SIZE +
|
||||
pool->buff_size *
|
||||
(idx * BITMAP_WORD_SIZE +
|
||||
bit_idx);
|
||||
|
||||
/* Update allocation bitmaps information for
|
||||
@ -231,7 +233,8 @@ void *malloc(unsigned int num_bytes)
|
||||
|
||||
/* Check if bytes requested extend page-size */
|
||||
if (num_bytes < CPU_PAGE_SIZE) {
|
||||
/* Request memory allocation from smaller segmented memory pool
|
||||
/*
|
||||
* Request memory allocation from smaller segmented memory pool
|
||||
*/
|
||||
memory = allocate_mem(&Memory_Pool, num_bytes);
|
||||
} else {
|
||||
@ -308,12 +311,10 @@ void *memchr(const void *void_s, int c, size_t n)
|
||||
unsigned char *end = ptr + n;
|
||||
|
||||
while (ptr < end) {
|
||||
|
||||
if (*ptr == val)
|
||||
return ((void *)ptr);
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -347,14 +348,12 @@ void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen)
|
||||
uint8_t *dest8;
|
||||
uint8_t *src8;
|
||||
|
||||
if (slen == 0U || dmax == 0U || dmax < slen) {
|
||||
if (slen == 0U || dmax == 0U || dmax < slen)
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
if ((d > s && d <= s + slen - 1)
|
||||
|| (d < s && s <= d + dmax - 1)) {
|
||||
|| (d < s && s <= d + dmax - 1))
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
/*same memory block, no need to copy*/
|
||||
if (d == s)
|
||||
|
Loading…
Reference in New Issue
Block a user