summaryrefslogtreecommitdiffstats
path: root/src/H5Odtype.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/H5Odtype.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/H5Odtype.c')
-rw-r--r--src/H5Odtype.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 622a18e..cee6e1e 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -13,8 +13,9 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#define H5O_PACKAGE /*suppress error about including H5Opkg */
-#define H5T_PACKAGE /*prevent warning from including H5Tpkg */
+#include "H5Omodule.h" /* This source code file is part of the H5O module */
+#define H5T_FRIEND /*prevent warning from including H5Tpkg */
+
#include "H5private.h" /* Generic Functions */
#include "H5Dprivate.h" /* Datasets */
@@ -35,7 +36,7 @@ static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
static void *H5O_dtype_copy(const void *_mesg, void *_dest);
static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_dtype_reset(void *_mesg);
-static herr_t H5O_dtype_free(void *_mesg);
+static herr_t H5O__dtype_free(void *_mesg);
static herr_t H5O_dtype_set_share(void *_mesg, const H5O_shared_t *sh);
static htri_t H5O_dtype_can_share(const void *_mesg);
static herr_t H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
@@ -101,7 +102,7 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{
H5O_dtype_copy, /* copy the native value */
H5O_dtype_shared_size, /* size of raw message */
H5O_dtype_reset, /* reset method */
- H5O_dtype_free, /* free method */
+ H5O__dtype_free, /* free method */
H5O_dtype_shared_delete, /* file delete method */
H5O_dtype_shared_link, /* link method */
H5O_dtype_set_share, /* set share method */
@@ -1093,7 +1094,7 @@ H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *o
unsigned *ioflags/*in,out*/, const uint8_t *p)
{
H5T_t *dt = NULL;
- void *ret_value; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1175,9 +1176,9 @@ done:
static void *
H5O_dtype_copy(const void *_src, void *_dst)
{
- const H5T_t *src = (const H5T_t *) _src;
- H5T_t *dst;
- void *ret_value; /* Return value */
+ const H5T_t *src = (const H5T_t *) _src;
+ H5T_t *dst;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1224,7 +1225,7 @@ H5O_dtype_size(const H5F_t *f, const void *_mesg)
{
const H5T_t *dt = (const H5T_t *)_mesg;
unsigned u; /* Local index variable */
- size_t ret_value;
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1369,31 +1370,34 @@ H5O_dtype_reset(void *_mesg)
/*-------------------------------------------------------------------------
- * Function: H5O_dtype_free
+ * Function: H5O__dtype_free
*
- * Purpose: Free's the message
+ * Purpose: Frees the message
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, March 30, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_dtype_free(void *mesg)
+H5O__dtype_free(void *mesg)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
HDassert(mesg);
- ((H5T_t *) mesg)->shared = H5FL_FREE(H5T_shared_t, ((H5T_t *) mesg)->shared);
- mesg = H5FL_FREE(H5T_t, mesg);
+ /* Release the datatype */
+ if(H5T_close((H5T_t *)mesg) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free datatype")
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_dtype_free() */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O__dtype_free() */
/*-------------------------------------------------------------------------
@@ -1562,7 +1566,7 @@ H5O_dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg_
H5O_copy_t H5_ATTR_UNUSED *cpy_info, void H5_ATTR_UNUSED *udata, hid_t H5_ATTR_UNUSED dxpl_id)
{
H5T_t *dst_mesg; /* Destination datatype */
- void *ret_value; /* Return value */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT