summaryrefslogtreecommitdiffstats
path: root/src/H5HLint.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 16:47:45 (GMT)
commit1ba1f2f3222cbe8df0bf601929a4bffd478d7e02 (patch)
treeae51dfc33cf40432dad25a5088767115a98f195e /src/H5HLint.c
parent8eef7d295cc3dd134aef0a826f1de4287629996d (diff)
downloadhdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.zip
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.gz
hdf5-1ba1f2f3222cbe8df0bf601929a4bffd478d7e02.tar.bz2
Source formatted
Diffstat (limited to 'src/H5HLint.c')
-rw-r--r--src/H5HLint.c86
1 files changed, 34 insertions, 52 deletions
diff --git a/src/H5HLint.c b/src/H5HLint.c
index f9f34e0..6f1983e 100644
--- a/src/H5HLint.c
+++ b/src/H5HLint.c
@@ -26,47 +26,39 @@
/* Module Setup */
/****************/
-#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */
-
+#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5HLpkg.h" /* Local Heaps */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5HLpkg.h" /* Local Heaps */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -80,8 +72,6 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t);
/* Declare a free list to manage the H5HL_prfx_t struct */
H5FL_DEFINE_STATIC(H5HL_prfx_t);
-
-
/*-------------------------------------------------------------------------
* Function: H5HL_new
*
@@ -99,8 +89,8 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t);
H5HL_t *
H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
{
- H5HL_t *heap = NULL; /* New local heap */
- H5HL_t *ret_value; /* Return value */
+ H5HL_t *heap = NULL; /* New local heap */
+ H5HL_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -110,13 +100,13 @@ H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
HDassert(prfx_size > 0);
/* Allocate new local heap structure */
- if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+ if (NULL == (heap = H5FL_CALLOC(H5HL_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Initialize non-zero fields */
heap->sizeof_size = sizeof_size;
heap->sizeof_addr = sizeof_addr;
- heap->prfx_size = prfx_size;
+ heap->prfx_size = prfx_size;
/* Set the return value */
ret_value = heap;
@@ -125,7 +115,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_new() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_inc_rc
*
@@ -154,7 +143,6 @@ H5HL_inc_rc(H5HL_t *heap)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL_inc_rc() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_dec_rc
*
@@ -181,13 +169,12 @@ H5HL_dec_rc(H5HL_t *heap)
heap->rc--;
/* Check if we should destroy the heap */
- if(heap->rc == 0)
+ if (heap->rc == 0)
H5HL_dest(heap);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL_dec_rc() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_dest
*
@@ -215,21 +202,20 @@ H5HL_dest(H5HL_t *heap)
HDassert(heap->prfx == NULL);
HDassert(heap->dblk == NULL);
- if(heap->dblk_image)
+ if (heap->dblk_image)
heap->dblk_image = H5FL_BLK_FREE(lheap_chunk, heap->dblk_image);
- while(heap->freelist) {
- H5HL_free_t *fl;
+ while (heap->freelist) {
+ H5HL_free_t *fl;
- fl = heap->freelist;
+ fl = heap->freelist;
heap->freelist = fl->next;
- fl = H5FL_FREE(H5HL_free_t, fl);
+ fl = H5FL_FREE(H5HL_free_t, fl);
} /* end while */
heap = H5FL_FREE(H5HL_t, heap);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HL_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_prfx_new
*
@@ -247,8 +233,8 @@ H5HL_dest(H5HL_t *heap)
H5HL_prfx_t *
H5HL_prfx_new(H5HL_t *heap)
{
- H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
- H5HL_prfx_t *ret_value; /* Return value */
+ H5HL_prfx_t *prfx = NULL; /* New local heap prefix */
+ H5HL_prfx_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -256,12 +242,12 @@ H5HL_prfx_new(H5HL_t *heap)
HDassert(heap);
/* Allocate new local heap prefix */
- if(NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+ if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Increment ref. count on heap data structure */
- if(H5HL_inc_rc(heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
+ if (H5HL_inc_rc(heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the prefix */
prfx->heap = heap;
@@ -274,7 +260,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_prfx_new() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_prfx_dest
*
@@ -292,7 +277,7 @@ done:
herr_t
H5HL_prfx_dest(H5HL_prfx_t *prfx)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -300,12 +285,12 @@ H5HL_prfx_dest(H5HL_prfx_t *prfx)
HDassert(prfx);
/* Check if prefix was initialized */
- if(prfx->heap) {
+ if (prfx->heap) {
/* Unlink prefix from heap */
prfx->heap->prfx = NULL;
/* Decrement ref. count on heap data structure */
- if(H5HL_dec_rc(prfx->heap) < 0)
+ if (H5HL_dec_rc(prfx->heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from prefix */
@@ -319,7 +304,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_prfx_dest() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_dblk_new
*
@@ -337,8 +321,8 @@ done:
H5HL_dblk_t *
H5HL_dblk_new(H5HL_t *heap)
{
- H5HL_dblk_t *dblk = NULL; /* New local heap data block */
- H5HL_dblk_t *ret_value; /* Return value */
+ H5HL_dblk_t *dblk = NULL; /* New local heap data block */
+ H5HL_dblk_t *ret_value; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -346,12 +330,12 @@ H5HL_dblk_new(H5HL_t *heap)
HDassert(heap);
/* Allocate new local heap data block */
- if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
- HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
+ if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")
/* Increment ref. count on heap data structure */
- if(H5HL_inc_rc(heap) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
+ if (H5HL_inc_rc(heap) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")
/* Link the heap & the data block */
dblk->heap = heap;
@@ -364,7 +348,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_new() */
-
/*-------------------------------------------------------------------------
* Function: H5HL_dblk_dest
*
@@ -382,7 +365,7 @@ done:
herr_t
H5HL_dblk_dest(H5HL_dblk_t *dblk)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -390,16 +373,16 @@ H5HL_dblk_dest(H5HL_dblk_t *dblk)
HDassert(dblk);
/* Check if data block was initialized */
- if(dblk->heap) {
+ if (dblk->heap) {
/* Unlink data block from heap */
dblk->heap->dblk = NULL;
/* Unpin the local heap prefix */
- if(H5AC_unpin_entry(dblk->heap->prfx) < 0)
+ if (H5AC_unpin_entry(dblk->heap->prfx) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix")
/* Decrement ref. count on heap data structure */
- if(H5HL_dec_rc(dblk->heap) < 0)
+ if (H5HL_dec_rc(dblk->heap) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")
/* Unlink heap from data block */
@@ -412,4 +395,3 @@ H5HL_dblk_dest(H5HL_dblk_t *dblk)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_dest() */
-