summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
commit102337449220dfc29be1cce29147704b9c760832 (patch)
tree2f57d117f2bd934eac2768be18dcc866619f390f /src/H5HL.c
parentf16361d5f1dc70c344d8143270aa4aeaa867f244 (diff)
downloadhdf5-102337449220dfc29be1cce29147704b9c760832.zip
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.gz
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.bz2
[svn-r27768] Description:
Complete revamp of package initialization/shutdown mechanism in the library. Each package now has a single init/term routine. This new way should avoid packages being re-initialized during library shutdown and is also be _much_ more proactive about giving feedback for resource leaks internal to the library. Introduces a new "module" header file for packages in the library (e.g src/H5Fmodule.h) which sets up some necessary package configuration macros for the FUNC_ENTER/LEAVE macros. (The VFL drivers have their own slightly modified version of this header, src/H5FDdrvr_module.h) Also cleaned up a bunch of resources leaks all across the library and tests, along with addressing many warnings, as I encountered them. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel Linux/64 3.10.x (kituo) w/serial & parallel Linux/64 2.6.x (ostrich) w/serial
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index 49af528..7631e8c 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -29,7 +29,7 @@
/* Module Setup */
/****************/
-#define H5HL_PACKAGE /* Suppress error about including H5HLpkg */
+#include "H5HLmodule.h" /* This source code file is part of the H5HL module */
/***********/
@@ -71,6 +71,9 @@ static herr_t H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap);
/* Package Variables */
/*********************/
+/* Package initialization variable */
+hbool_t H5_PKG_INIT_VAR = FALSE;
+
/* Declare a free list to manage the H5HL_free_t struct */
H5FL_DEFINE(H5HL_free_t);
@@ -115,7 +118,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/)
{
H5HL_t *heap = NULL; /* Heap created */
H5HL_prfx_t *prfx = NULL; /* Heap prefix */
- hsize_t total_size; /* Total heap size on disk */
+ hsize_t total_size = 0; /* Total heap size on disk */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -446,10 +449,10 @@ H5HL_protect(H5F_t *f, hid_t dxpl_id, haddr_t addr, unsigned flags)
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
H5HL_dblk_t *dblk = NULL; /* Local heap data block */
- H5HL_t *heap; /* Heap data structure */
+ H5HL_t *heap = NULL; /* Heap data structure */
unsigned prfx_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting prefix entry */
unsigned dblk_cache_flags = H5AC__NO_FLAGS_SET; /* Cache flags for unprotecting data block entry */
- H5HL_t *ret_value; /* Return value */
+ H5HL_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -700,7 +703,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
size_t offset = 0;
size_t need_size;
hbool_t found;
- size_t ret_value; /* Return value */
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI(UFAIL)
@@ -1062,7 +1065,7 @@ done:
herr_t
H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr)
{
- H5HL_t *heap; /* Local heap to delete */
+ H5HL_t *heap = NULL; /* Local heap to delete */
H5HL_cache_prfx_ud_t prfx_udata; /* User data for protecting local heap prefix */
H5HL_prfx_t *prfx = NULL; /* Local heap prefix */
H5HL_dblk_t *dblk = NULL; /* Local heap data block */