Styles fixes in liballocator: indentation and braces rules.
This commit is contained in:
@@ -33,7 +33,8 @@
|
|||||||
*
|
*
|
||||||
* @see mem_heap_alloc_block
|
* @see mem_heap_alloc_block
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
MEM_HEAP_ALLOC_SHORT_TERM, /**< allocated region will be freed soon */
|
MEM_HEAP_ALLOC_SHORT_TERM, /**< allocated region will be freed soon */
|
||||||
MEM_HEAP_ALLOC_LONG_TERM /**< allocated region most likely will not be freed soon */
|
MEM_HEAP_ALLOC_LONG_TERM /**< allocated region most likely will not be freed soon */
|
||||||
} mem_heap_alloc_term_t;
|
} mem_heap_alloc_term_t;
|
||||||
@@ -49,7 +50,8 @@ extern void mem_heap_print (bool dump_block_headers, bool dump_block_data, bool
|
|||||||
/**
|
/**
|
||||||
* Heap memory usage statistics
|
* Heap memory usage statistics
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
size_t size; /**< size */
|
size_t size; /**< size */
|
||||||
size_t blocks; /**< blocks count */
|
size_t blocks; /**< blocks count */
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ mem_pool_init (mem_pool_state_t *pool_p, /**< pool */
|
|||||||
chunk_index < chunks_number;
|
chunk_index < chunks_number;
|
||||||
chunk_index++)
|
chunk_index++)
|
||||||
{
|
{
|
||||||
mem_pool_chunk_index_t *next_free_chunk_index_p =
|
mem_pool_chunk_index_t *next_free_chunk_index_p = (mem_pool_chunk_index_t*) MEM_POOL_CHUNK_ADDRESS(pool_p,
|
||||||
(mem_pool_chunk_index_t*) MEM_POOL_CHUNK_ADDRESS(pool_p, chunk_index);
|
chunk_index);
|
||||||
|
|
||||||
*next_free_chunk_index_p = (mem_pool_chunk_index_t) (chunk_index + 1u);
|
*next_free_chunk_index_p = (mem_pool_chunk_index_t) (chunk_index + 1u);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ typedef uint16_t mem_pool_chunk_index_t;
|
|||||||
/**
|
/**
|
||||||
* State of a memory pool
|
* State of a memory pool
|
||||||
*/
|
*/
|
||||||
typedef struct mem_pool_state_t {
|
typedef struct mem_pool_state_t
|
||||||
|
{
|
||||||
/** Number of chunks (mem_pool_chunk_index_t) */
|
/** Number of chunks (mem_pool_chunk_index_t) */
|
||||||
unsigned int chunks_number : MEM_POOL_MAX_CHUNKS_NUMBER_LOG;
|
unsigned int chunks_number : MEM_POOL_MAX_CHUNKS_NUMBER_LOG;
|
||||||
/** Number of free chunks (mem_pool_chunk_index_t) */
|
/** Number of free chunks (mem_pool_chunk_index_t) */
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ size_t mem_free_chunks_number;
|
|||||||
|
|
||||||
#ifdef MEM_STATS
|
#ifdef MEM_STATS
|
||||||
/**
|
/**
|
||||||
* Pools' memory usage statistics
|
* Pools' memory usage statistics
|
||||||
*/
|
*/
|
||||||
mem_pools_stats_t mem_pools_stats;
|
mem_pools_stats_t mem_pools_stats;
|
||||||
|
|
||||||
@@ -117,8 +117,15 @@ mem_pools_alloc (void)
|
|||||||
|
|
||||||
mem_pool_init (pool_state, pool_size);
|
mem_pool_init (pool_state, pool_size);
|
||||||
|
|
||||||
pool_state->next_pool_cp = (mem_pools == NULL) ? MEM_COMPRESSED_POINTER_NULL
|
if (mem_pools == NULL)
|
||||||
: (uint16_t) mem_compress_pointer (mem_pools);
|
{
|
||||||
|
pool_state->next_pool_cp = MEM_COMPRESSED_POINTER_NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pool_state->next_pool_cp = (uint16_t) mem_compress_pointer (mem_pools);
|
||||||
|
}
|
||||||
|
|
||||||
mem_pools = pool_state;
|
mem_pools = pool_state;
|
||||||
|
|
||||||
mem_free_chunks_number += pool_state->chunks_number;
|
mem_free_chunks_number += pool_state->chunks_number;
|
||||||
|
|||||||
Reference in New Issue
Block a user