summaryrefslogtreecommitdiffstats
path: root/src/H5FL.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FL.c')
-rw-r--r--src/H5FL.c94
1 files changed, 30 insertions, 64 deletions
diff --git a/src/H5FL.c b/src/H5FL.c
index 8c110ed..d9cb5c6 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -185,7 +185,7 @@ H5FL_init_interface(void)
static void *
H5FL_malloc(size_t mem_size)
{
- void *ret_value; /* return value*/
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -258,8 +258,7 @@ done:
*
* Purpose: Release an object & put on free list
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Always returns NULL
*
* Programmer: Quincey Koziol
* Friday, March 24, 2000
@@ -353,7 +352,7 @@ done:
void *
H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to object to return */
FUNC_ENTER_NOAPI(NULL)
@@ -427,7 +426,7 @@ done:
void *
H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to object to return */
FUNC_ENTER_NOAPI(NULL)
@@ -505,10 +504,6 @@ H5FL_reg_gc_list(H5FL_reg_head_t *head)
* Programmer: Quincey Koziol
* Friday, March 24, 2000
*
- * Modifications:
- * Broke into two parts, one for looping over all the free lists and
- * another for freeing each list - QAK 7/25/00
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -629,7 +624,7 @@ H5FL_reg_term(void)
static H5FL_blk_node_t *
H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
{
- H5FL_blk_node_t *temp; /* Temp. pointer to node in the native list */
+ H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -687,8 +682,8 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size)
static H5FL_blk_node_t *
H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size)
{
- H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */
- H5FL_blk_node_t *ret_value;
+ H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */
+ H5FL_blk_node_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -775,8 +770,8 @@ done:
htri_t
H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size)
{
- H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */
- htri_t ret_value; /* Return value */
+ H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -812,9 +807,9 @@ done:
void *
H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
{
- H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */
- H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */
- void * ret_value; /* Pointer to the block to return to the user */
+ H5FL_blk_node_t *free_list; /* The free list of nodes of correct size */
+ H5FL_blk_list_t *temp; /* Temp. ptr to the new native list allocated */
+ void * ret_value = NULL; /* Pointer to the block to return to the user */
FUNC_ENTER_NOAPI(NULL)
@@ -900,7 +895,7 @@ done:
void *
H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to the block to return to the user */
+ void *ret_value = NULL; /* Pointer to the block to return to the user */
FUNC_ENTER_NOAPI(NULL)
@@ -988,7 +983,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
HDmemset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE);
#endif /* H5FL_DEBUG */
- /* check if there is a free list for native blocks of this size */
+ /* Check if there is a free list for native blocks of this size */
if ((free_list = H5FL_blk_find_list(&(head->head), free_size)) == NULL) {
/* No free list available, create a new list node and insert it to the queue */
free_list = H5FL_blk_create_list(&(head->head), free_size);
@@ -1230,8 +1225,8 @@ H5FL_blk_term(void)
tmp = H5FL_blk_gc_head.first->next;
#ifdef H5FL_DEBUG
- printf("H5FL_blk_term: head->name=%s, head->allocated=%d\n", H5FL_blk_gc_head.first->pq->name,
- (int)H5FL_blk_gc_head.first->pq->allocated);
+ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name,
+ (int)H5FL_blk_gc_head.first->pq->allocated);
#endif /* H5FL_DEBUG */
/* Check if the list has allocations outstanding */
@@ -1402,9 +1397,9 @@ done:
void *
H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem)
{
- H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */
- void * ret_value; /* Pointer to object to return */
- size_t mem_size; /* Size of memory block being recycled */
+ H5FL_arr_list_t *new_obj; /* Pointer to the new free list node allocated */
+ size_t mem_size; /* Size of memory block being recycled */
+ void * ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1474,7 +1469,7 @@ done:
void *
H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1509,7 +1504,7 @@ done:
void *
H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1685,8 +1680,8 @@ H5FL_arr_term(void)
/* Check if the list has allocations outstanding */
#ifdef H5FL_DEBUG
- printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.first->list->name,
- (int)H5FL_arr_gc_head.first->list->allocated);
+ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name,
+ (int)H5FL_arr_gc_head.first->list->allocated);
#endif /* H5FL_DEBUG */
if (H5FL_arr_gc_head.first->list->allocated > 0) {
/* Add free list to the list of nodes with allocations open still */
@@ -1763,7 +1758,7 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj)
void *
H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1794,7 +1789,7 @@ done:
void *
H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1825,7 +1820,7 @@ done:
void *
H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
FUNC_ENTER_NOAPI(NULL)
@@ -1851,19 +1846,14 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
H5FL_fac_head_t *
H5FL_fac_init(size_t size)
{
- H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */
- H5FL_fac_head_t * factory = NULL; /* Pointer to new block factory */
- H5FL_fac_head_t * ret_value; /* Return value */
+ H5FL_fac_gc_node_t *new_node = NULL; /* Pointer to the node for the new list to garbage collect */
+ H5FL_fac_head_t * factory = NULL; /* Pointer to new block factory */
+ H5FL_fac_head_t * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1927,11 +1917,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2015,11 +2000,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
@@ -2091,17 +2071,12 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
void *
H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
{
- void *ret_value; /* Pointer to object to return */
+ void *ret_value = NULL; /* Pointer to the block to return */
/* NOINIT OK here because this must be called after H5FL_fac_init -NAF */
FUNC_ENTER_NOAPI_NOINIT
@@ -2219,11 +2194,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, February 2, 2005
*
- * Modifications:
- * Neil Fortner
- * Friday, December 19, 2008
- * Totally rewritten to support new factory implementation
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -2383,10 +2353,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, August 2, 2000
*
- * Modifications: Neil Fortner
- * Wednesday, April 8, 2009
- * Added support for factory free lists
- *
*-------------------------------------------------------------------------
*/
herr_t