summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-07-16 19:54:26 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-07-16 19:54:26 (GMT)
commit75f4e51a1a076ea2f1602619e2a7d7bcce13c2f1 (patch)
treeb6e08ce3ecbd535ffe74269d7e44c905e19b137d
parent2e3ab09a520ff87ec709b5997273ce7f3b99d9ed (diff)
downloadhdf5-75f4e51a1a076ea2f1602619e2a7d7bcce13c2f1.zip
hdf5-75f4e51a1a076ea2f1602619e2a7d7bcce13c2f1.tar.gz
hdf5-75f4e51a1a076ea2f1602619e2a7d7bcce13c2f1.tar.bz2
[svn-r22582] Description:
Refactor ID class registration to be more like how other "class"s in the library are registered, and clean up compiler warnings. Tested on: Mac OSX/64 10.7.4 (amazon) w/debug (Too minor to require h5comittest)
-rw-r--r--src/H5A.c17
-rw-r--r--src/H5AC.c12
-rw-r--r--src/H5Abtree2.c20
-rw-r--r--src/H5Adeprec.c12
-rw-r--r--src/H5Aint.c76
-rw-r--r--src/H5C.c6
-rw-r--r--src/H5D.c2
-rw-r--r--src/H5Dfill.c4
-rw-r--r--src/H5Dint.c11
-rw-r--r--src/H5Dpkg.h3
-rw-r--r--src/H5E.c66
-rw-r--r--src/H5F.c54
-rw-r--r--src/H5FD.c12
-rw-r--r--src/H5G.c13
-rw-r--r--src/H5I.c218
-rw-r--r--src/H5Ipkg.h2
-rw-r--r--src/H5Iprivate.h56
-rw-r--r--src/H5Pint.c24
-rw-r--r--src/H5R.c51
-rw-r--r--src/H5S.c49
-rw-r--r--src/H5T.c488
-rw-r--r--src/H5Tpkg.h3
-rw-r--r--test/tid.c18
23 files changed, 742 insertions, 475 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 63a908d..e1aeaac 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -41,9 +41,6 @@
/* Local Macros */
/****************/
-/* The number of reserved IDs in dataset ID group */
-#define H5A_RESERVED_ATOMS 0
-
/******************/
/* Local Typedefs */
@@ -94,6 +91,16 @@ H5FL_DEFINE(H5A_shared_t);
/* Declare a free list to manage blocks of type conversion data */
H5FL_BLK_DEFINE(attr_buf);
+/* Attribute ID class */
+static const H5I_class_t H5I_ATTR_CLS[1] = {{
+ H5I_ATTR, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5A_close /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5A_init
@@ -143,7 +150,7 @@ H5A_init_interface(void)
/*
* Create attribute ID type.
*/
- if(H5I_register_type(H5I_ATTR, (size_t)H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close) < H5I_FILE)
+ if(H5I_register_type(H5I_ATTR_CLS) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
@@ -172,7 +179,7 @@ H5A_term_interface(void)
{
int n = 0;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if(H5_interface_initialize_g) {
if((n = H5I_nmembers(H5I_ATTR))>0) {
diff --git a/src/H5AC.c b/src/H5AC.c
index 51c4ce5..99caf28 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -342,14 +342,14 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
#else /* H5_HAVE_PARALLEL */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- assert(H5P_LST_DATASET_XFER_g!=(-1));
+ HDassert(H5P_LST_DATASET_XFER_g!=(-1));
- H5AC_dxpl_id=H5P_DATASET_XFER_DEFAULT;
- H5AC_noblock_dxpl_id=H5P_DATASET_XFER_DEFAULT;
- H5AC_ind_dxpl_id=H5P_DATASET_XFER_DEFAULT;
+ H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ H5AC_noblock_dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT;
FUNC_LEAVE_NOAPI(SUCCEED)
#endif /* H5_HAVE_PARALLEL */
@@ -376,7 +376,7 @@ H5AC_term_interface(void)
{
int n = 0;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
if (H5_interface_initialize_g) {
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 5a15c20..9b7dba6 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -222,7 +222,7 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Copy user information info native record */
nrecord->id = udata->id;
@@ -255,7 +255,7 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec;
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
HDassert(bt2_udata);
@@ -323,7 +323,7 @@ H5A_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void UNUSED *ct
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Encode the record's fields */
HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
@@ -354,7 +354,7 @@ H5A_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void UNUSED *ct
{
H5A_dense_bt2_name_rec_t *nrecord = (H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Decode the record's fields */
HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
@@ -386,7 +386,7 @@ H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dx
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u, %08lx}\n", indent, "", fwidth,
"Record:",
@@ -415,7 +415,7 @@ H5A_dense_btree2_corder_store(void *_nrecord, const void *_udata)
const H5A_bt2_ud_ins_t *udata = (const H5A_bt2_ud_ins_t *)_udata;
H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Copy user information info native record */
nrecord->id = udata->id;
@@ -447,7 +447,7 @@ H5A_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec)
const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec;
herr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
HDassert(bt2_udata);
@@ -483,7 +483,7 @@ H5A_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void UNUSED *
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Encode the record's fields */
HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN);
@@ -513,7 +513,7 @@ H5A_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void UNUSED *
{
H5A_dense_bt2_corder_rec_t *nrecord = (H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Decode the record's fields */
HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN);
@@ -544,7 +544,7 @@ H5A_dense_btree2_corder_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDfprintf(stream, "%*s%-*s {%016Hx, %02x, %u}\n", indent, "", fwidth,
"Record:",
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 22faaa2..7202edf 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -35,7 +35,7 @@
#define H5O_PACKAGE /*suppress error about including H5Opkg */
/* Interface initialization */
-#define H5_INTERFACE_INIT_FUNC H5A_init_deprec_interface
+#define H5_INTERFACE_INIT_FUNC H5A__init_deprec_interface
/***********/
@@ -87,9 +87,9 @@
/*--------------------------------------------------------------------------
NAME
- H5A_init_deprec_interface -- Initialize interface-specific information
+ H5A__init_deprec_interface -- Initialize interface-specific information
USAGE
- herr_t H5A_init_deprec_interface()
+ herr_t H5A__init_deprec_interface()
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -98,12 +98,12 @@ DESCRIPTION
--------------------------------------------------------------------------*/
static herr_t
-H5A_init_deprec_interface(void)
+H5A__init_deprec_interface(void)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
FUNC_LEAVE_NOAPI(H5A_init())
-} /* H5A_init_deprec_interface() */
+} /* H5A__init_deprec_interface() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 74c5590..9503a1c 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -90,14 +90,14 @@ typedef struct {
/* Local Prototypes */
/********************/
-static herr_t H5A_compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
+static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
static herr_t H5A_dense_build_table_cb(const H5A_t *attr, void *_udata);
-static int H5A_attr_cmp_name_inc(const void *attr1, const void *attr2);
-static int H5A_attr_cmp_name_dec(const void *attr1, const void *attr2);
-static int H5A_attr_cmp_corder_inc(const void *attr1, const void *attr2);
-static int H5A_attr_cmp_corder_dec(const void *attr1, const void *attr2);
-static herr_t H5A_attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
+static int H5A__attr_cmp_name_inc(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_name_dec(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2);
+static int H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2);
+static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
H5_iter_order_t order);
/*********************/
@@ -119,7 +119,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
/*-------------------------------------------------------------------------
- * Function: H5A_compact_build_table_cb
+ * Function: H5A__compact_build_table_cb
*
* Purpose: Object header iterator callback routine to copy attribute
* into table.
@@ -137,13 +137,13 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_compact_build_table_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
+H5A__compact_build_table_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned UNUSED *oh_modified, void *_udata/*in,out*/)
{
H5A_compact_bt_ud_t *udata = (H5A_compact_bt_ud_t *)_udata; /* Operator user data */
herr_t ret_value = H5_ITER_CONT; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC
/* check args */
HDassert(mesg);
@@ -176,7 +176,7 @@ H5A_compact_build_table_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_compact_build_table_cb() */
+} /* end H5A__compact_build_table_cb() */
/*-------------------------------------------------------------------------
@@ -225,7 +225,7 @@ H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type,
/* Iterate over existing attributes, checking for attribute with same name */
op.op_type = H5O_MESG_OP_LIB;
- op.u.lib_op = H5A_compact_build_table_cb;
+ op.u.lib_op = H5A__compact_build_table_cb;
if(H5O_msg_iterate_real(f, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error building attribute table")
@@ -235,7 +235,7 @@ H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type,
/* Don't sort an empty table. */
if(atable->nattrs > 0) {
/* Sort attribute table in correct iteration order */
- if(H5A_attr_sort_table(atable, idx_type, order) < 0)
+ if(H5A__attr_sort_table(atable, idx_type, order) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table")
} /* end if */
@@ -359,7 +359,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table")
/* Sort attribute table in correct iteration order */
- if(H5A_attr_sort_table(atable, idx_type, order) < 0)
+ if(H5A__attr_sort_table(atable, idx_type, order) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table")
} /* end if */
else
@@ -375,7 +375,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_attr_cmp_name_inc
+ * Function: H5A__attr_cmp_name_inc
*
* Purpose: Callback routine for comparing two attribute names, in
* increasing alphabetic order
@@ -393,17 +393,17 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5A_attr_cmp_name_inc(const void *attr1, const void *attr2)
+H5A__attr_cmp_name_inc(const void *attr1, const void *attr2)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr1)->shared->name,
(*(const H5A_t * const *)attr2)->shared->name))
-} /* end H5A_attr_cmp_name_inc() */
+} /* end H5A__attr_cmp_name_inc() */
/*-------------------------------------------------------------------------
- * Function: H5A_attr_cmp_name_dec
+ * Function: H5A__attr_cmp_name_dec
*
* Purpose: Callback routine for comparing two attribute names, in
* decreasing alphabetic order
@@ -421,17 +421,17 @@ H5A_attr_cmp_name_inc(const void *attr1, const void *attr2)
*-------------------------------------------------------------------------
*/
static int
-H5A_attr_cmp_name_dec(const void *attr1, const void *attr2)
+H5A__attr_cmp_name_dec(const void *attr1, const void *attr2)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
FUNC_LEAVE_NOAPI(HDstrcmp((*(const H5A_t * const *)attr2)->shared->name,
(*(const H5A_t * const *)attr1)->shared->name))
-} /* end H5A_attr_cmp_name_dec() */
+} /* end H5A__attr_cmp_name_dec() */
/*-------------------------------------------------------------------------
- * Function: H5A_attr_cmp_corder_inc
+ * Function: H5A__attr_cmp_corder_inc
*
* Purpose: Callback routine for comparing two attributes, in
* increasing creation order
@@ -448,11 +448,11 @@ H5A_attr_cmp_name_dec(const void *attr1, const void *attr2)
*-------------------------------------------------------------------------
*/
static int
-H5A_attr_cmp_corder_inc(const void *attr1, const void *attr2)
+H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2)
{
int ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx)
ret_value = -1;
@@ -462,11 +462,11 @@ H5A_attr_cmp_corder_inc(const void *attr1, const void *attr2)
ret_value = 0;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_attr_cmp_corder_inc() */
+} /* end H5A__attr_cmp_corder_inc() */
/*-------------------------------------------------------------------------
- * Function: H5A_attr_cmp_corder_dec
+ * Function: H5A__attr_cmp_corder_dec
*
* Purpose: Callback routine for comparing two attributes, in
* decreasing creation order
@@ -483,11 +483,11 @@ H5A_attr_cmp_corder_inc(const void *attr1, const void *attr2)
*-------------------------------------------------------------------------
*/
static int
-H5A_attr_cmp_corder_dec(const void *attr1, const void *attr2)
+H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2)
{
int ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
if((*(const H5A_t * const *)attr1)->shared->crt_idx < (*(const H5A_t * const *)attr2)->shared->crt_idx)
ret_value = 1;
@@ -497,11 +497,11 @@ H5A_attr_cmp_corder_dec(const void *attr1, const void *attr2)
ret_value = 0;
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_attr_cmp_corder_dec() */
+} /* end H5A__attr_cmp_corder_dec() */
/*-------------------------------------------------------------------------
- * Function: H5A_attr_sort_table
+ * Function: H5A__attr_sort_table
*
* Purpose: Sort table containing a list of attributes for an object
*
@@ -514,10 +514,10 @@ H5A_attr_cmp_corder_dec(const void *attr1, const void *attr2)
*-------------------------------------------------------------------------
*/
static herr_t
-H5A_attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
+H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
H5_iter_order_t order)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(atable);
@@ -525,24 +525,24 @@ H5A_attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type,
/* Pick appropriate comparison routine */
if(idx_type == H5_INDEX_NAME) {
if(order == H5_ITER_INC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A_attr_cmp_name_inc);
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_name_inc);
else if(order == H5_ITER_DEC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A_attr_cmp_name_dec);
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_name_dec);
else
HDassert(order == H5_ITER_NATIVE);
} /* end if */
else {
HDassert(idx_type == H5_INDEX_CRT_ORDER);
if(order == H5_ITER_INC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A_attr_cmp_corder_inc);
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_corder_inc);
else if(order == H5_ITER_DEC)
- HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A_attr_cmp_corder_dec);
+ HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t*), H5A__attr_cmp_corder_dec);
else
HDassert(order == H5_ITER_NATIVE);
} /* end else */
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5A_attr_sort_table() */
+} /* end H5A__attr_sort_table() */
/*-------------------------------------------------------------------------
@@ -756,7 +756,7 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI_NOERR
/* check arguments */
HDassert(f);
diff --git a/src/H5C.c b/src/H5C.c
index 5323cab..f651fb2 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -5881,7 +5881,7 @@ static void
H5C_adjust_flush_dependency_rc(H5C_cache_entry_t * cache_entry,
unsigned old_child_height, unsigned new_child_height)
{
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(cache_entry);
@@ -9274,7 +9274,7 @@ H5C_mark_tagged_entries(H5C_t * cache_ptr, haddr_t tag)
H5C_cache_entry_t *next_entry_ptr; /* entry pointer */
unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Assertions */
HDassert(0); /* This function is not yet used. We shouldn't be in here yet. */
@@ -9433,7 +9433,7 @@ H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag)
{
unsigned u; /* Local index variable */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(cache_ptr);
diff --git a/src/H5D.c b/src/H5D.c
index da050ab..d204712 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -47,8 +47,6 @@
/* Local Prototypes */
/********************/
-static herr_t H5D__init_pub_interface(void);
-
/*********************/
/* Package Variables */
diff --git a/src/H5Dfill.c b/src/H5Dfill.c
index 0d9c9e7..2edb363 100644
--- a/src/H5Dfill.c
+++ b/src/H5Dfill.c
@@ -646,7 +646,7 @@ done:
static herr_t
H5D__fill_release(H5D_fill_buf_info_t *fb_info)
{
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(fb_info);
@@ -684,7 +684,7 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info)
herr_t
H5D__fill_term(H5D_fill_buf_info_t *fb_info)
{
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_PACKAGE_NOERR
/* Check args */
HDassert(fb_info);
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 62d0f09..f313e52 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -106,6 +106,15 @@ H5FL_EXTERN(H5D_chunk_info_t);
/* Define a static "default" dataset structure to use to initialize new datasets */
static H5D_shared_t H5D_def_dset;
+/* Dataset ID class */
+static const H5I_class_t H5I_DATASET_CLS[1] = {{
+ H5I_DATASET, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5D_close /* Callback routine for closing objects of this class */
+}};
+
/*-------------------------------------------------------------------------
@@ -159,7 +168,7 @@ H5D__init_interface(void)
FUNC_ENTER_STATIC
/* Initialize the atom group for the dataset IDs */
- if(H5I_register_type(H5I_DATASET, (size_t)H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<H5I_FILE)
+ if(H5I_register_type(H5I_DATASET_CLS) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the "default dataset" information */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index b997423..dfc19b8 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -41,9 +41,6 @@
/* Package Private Macros */
/**************************/
-/* The number of reserved IDs in dataset ID group */
-#define H5D_RESERVED_ATOMS 0
-
/* Set the minimum object header size to create objects with */
#define H5D_MINHDR_SIZE 256
diff --git a/src/H5E.c b/src/H5E.c
index e74211e..72eec51 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -64,9 +64,6 @@
/* Local Macros */
/****************/
-/* Reserved atoms in for error API IDs */
-#define H5E_RESERVED_ATOMS 0
-
/* HDF5 error class */
#define H5E_CLS_NAME "HDF5"
#define H5E_CLS_LIB_NAME "HDF5"
@@ -85,6 +82,18 @@
/********************/
/* Local Prototypes */
/********************/
+/* Static function declarations */
+static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name,
+ const char *version);
+static herr_t H5E_unregister_class(H5E_cls_t *cls);
+static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size);
+static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
+static herr_t H5E_close_msg(H5E_msg_t *err);
+static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg);
+static H5E_t *H5E_get_current_stack(void);
+static herr_t H5E_set_current_stack(H5E_t *estack);
+static herr_t H5E_close_stack(H5E_t *err_stack);
+static ssize_t H5E_get_num(const H5E_t *err_stack);
/*********************/
@@ -101,20 +110,6 @@
/* Local Variables */
/*******************/
-
-/* Static function declarations */
-static H5E_cls_t *H5E_register_class(const char *cls_name, const char *lib_name,
- const char *version);
-static herr_t H5E_unregister_class(H5E_cls_t *cls);
-static ssize_t H5E_get_class_name(const H5E_cls_t *cls, char *name, size_t size);
-static int H5E_close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata);
-static herr_t H5E_close_msg(H5E_msg_t *err);
-static H5E_msg_t *H5E_create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg);
-static H5E_t *H5E_get_current_stack(void);
-static herr_t H5E_set_current_stack(H5E_t *estack);
-static herr_t H5E_close_stack(H5E_t *err_stack);
-static ssize_t H5E_get_num(const H5E_t *err_stack);
-
/* Declare a free list to manage the H5E_t struct */
H5FL_DEFINE_STATIC(H5E_t);
@@ -124,6 +119,34 @@ H5FL_DEFINE_STATIC(H5E_cls_t);
/* Declare a free list to manage the H5E_msg_t struct */
H5FL_DEFINE_STATIC(H5E_msg_t);
+/* Error class ID class */
+static const H5I_class_t H5I_ERRCLS_CLS[1] = {{
+ H5I_ERROR_CLASS, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5E_unregister_class /* Callback routine for closing objects of this class */
+}};
+
+/* Error message ID class */
+static const H5I_class_t H5I_ERRMSG_CLS[1] = {{
+ H5I_ERROR_MSG, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5E_close_msg /* Callback routine for closing objects of this class */
+}};
+
+/* Error stack ID class */
+static const H5I_class_t H5I_ERRSTK_CLS[1] = {{
+ H5I_ERROR_STACK, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5E_close_stack /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5E_init
@@ -213,18 +236,15 @@ H5E_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the error class IDs */
- if(H5I_register_type(H5I_ERROR_CLASS, (size_t)H5I_ERRCLS_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_unregister_class) < H5I_FILE)
+ if(H5I_register_type(H5I_ERRCLS_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the major error IDs */
- if(H5I_register_type(H5I_ERROR_MSG, (size_t)H5I_ERRMSG_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_close_msg) < H5I_FILE)
+ if(H5I_register_type(H5I_ERRMSG_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Initialize the atom group for the error stacks */
- if(H5I_register_type(H5I_ERROR_STACK, (size_t)H5I_ERRSTK_HASHSIZE, H5E_RESERVED_ATOMS,
- (H5I_free_t)H5E_close_stack) < H5I_FILE)
+ if(H5I_register_type(H5I_ERRSTK_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
#ifndef H5_HAVE_THREADSAFE
diff --git a/src/H5F.c b/src/H5F.c
index e1a9858..5d13ea6 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -13,13 +13,19 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5F_init_interface
-/* Packages needed by this file... */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Aprivate.h" /* Attributes */
#include "H5ACprivate.h" /* Metadata cache */
@@ -35,6 +41,15 @@
#include "H5SMprivate.h" /* Shared Object Header Messages */
#include "H5Tprivate.h" /* Datatypes */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
/* Struct only used by functions H5F_get_objects and H5F_get_objects_cb */
typedef struct H5F_olist_t {
H5I_type_t obj_type; /* Type of object to look for */
@@ -51,7 +66,15 @@ typedef struct H5F_olist_t {
size_t max_index; /* Maximum # of IDs to put into array */
} H5F_olist_t;
-/* PRIVATE PROTOTYPES */
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
static herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key);
static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id,
@@ -61,12 +84,37 @@ static herr_t H5F_build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl,
static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush);
static herr_t H5F_close(H5F_t *f);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Declare a free list to manage the H5F_t struct */
H5FL_DEFINE(H5F_t);
/* Declare a free list to manage the H5F_file_t struct */
H5FL_DEFINE(H5F_file_t);
+/* File ID class */
+static const H5I_class_t H5I_FILE_CLS[1] = {{
+ H5I_FILE, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5F_close /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5F_init
@@ -117,7 +165,7 @@ H5F_init_interface(void)
/*
* Initialize the atom group for the file IDs.
*/
- if(H5I_register_type(H5I_FILE, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE)
+ if(H5I_register_type(H5I_FILE_CLS) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
diff --git a/src/H5FD.c b/src/H5FD.c
index 18b0eb6..8ff9d9a 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -103,6 +103,16 @@ static int H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags/*o
*/
static unsigned long H5FD_file_serial_no_g;
+/* File driver ID class */
+static const H5I_class_t H5I_VFL_CLS[1] = {{
+ H5I_VFL, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5FD_free_cls /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5FD_init
@@ -153,7 +163,7 @@ H5FD_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
- if(H5I_register_type(H5I_VFL, (size_t)H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE)
+ if(H5I_register_type(H5I_VFL_CLS) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Reset the file serial numbers */
diff --git a/src/H5G.c b/src/H5G.c
index 3883ade..a0e7767 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -100,8 +100,6 @@
/* Local Macros */
/****************/
-#define H5G_RESERVED_ATOMS 0
-
/******************/
/* Local Typedefs */
@@ -132,6 +130,15 @@
/* Local Variables */
/*******************/
+/* Group ID class */
+static const H5I_class_t H5I_GROUP_CLS[1] = {{
+ H5I_GROUP, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5G_close /* Callback routine for closing objects of this class */
+}};
+
/*-------------------------------------------------------------------------
@@ -187,7 +194,7 @@ H5G_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the group IDs */
- if(H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, (H5I_free_t)H5G_close) < 0)
+ if(H5I_register_type(H5I_GROUP_CLS) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface")
done:
diff --git a/src/H5I.c b/src/H5I.c
index 0382e8e..581356e 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -22,7 +22,7 @@
* DESIGN: The types are stored in an array of pointers to store each
* type in an element. Each "type" node contains a link to a
* hash table to manage the IDs in each type. Allowed types are
- * values within the range 1 to MAX_NUM_TYPES and are given out
+ * values within the range 1 to H5I_MAX_NUM_TYPES and are given out
* at run-time. Types used by the library are stored in global
* variables defined in H5Ipublic.h.
*
@@ -98,14 +98,12 @@ typedef struct H5I_id_info_t {
/* ID type structure used */
typedef struct {
- unsigned count; /*# of times this type has been initialized*/
- unsigned reserved; /*# of IDs to reserve for constant IDs */
- unsigned wrapped; /*whether the id count has wrapped around */
- size_t hash_size; /*sizeof the hash table to store the IDs in */
- unsigned ids; /*current number of IDs held */
- unsigned nextid; /*ID to use for the next atom */
- H5I_free_t free_func; /*release object method */
- H5I_id_info_t **id_list; /*pointer to an array of ptrs to IDs */
+ const H5I_class_t *cls; /* Pointer to ID class */
+ unsigned count; /* # of times this type has been initialized*/
+ unsigned wrapped; /* Whether the id count has wrapped around */
+ unsigned ids; /* Current number of IDs held */
+ unsigned nextid; /* ID to use for the next atom */
+ H5I_id_info_t **id_list; /* Pointer to an array of ptrs to IDs */
} H5I_id_type_t;
typedef struct {
@@ -117,7 +115,7 @@ typedef struct {
/*-------------------- Locally scoped variables -----------------------------*/
/* Array of pointers to atomic types */
-static H5I_id_type_t *H5I_id_type_list_g[MAX_NUM_TYPES];
+static H5I_id_type_t *H5I_id_type_list_g[H5I_MAX_NUM_TYPES];
/* Variable to keep track of the number of types allocated. Its value is the */
/* next type ID to be handed out, so it is always one greater than the number */
@@ -130,6 +128,12 @@ static H5I_type_t H5I_next_type = (H5I_type_t) H5I_NTYPES;
/* Declare a free list to manage the H5I_id_info_t struct */
H5FL_DEFINE_STATIC(H5I_id_info_t);
+/* Declare a free list to manage the H5I_id_type_t struct */
+H5FL_DEFINE_STATIC(H5I_id_type_t);
+
+/* Declare a free list to manage the H5I_class_t struct */
+H5FL_DEFINE_STATIC(H5I_class_t);
+
/*--------------------- Local function prototypes ---------------------------*/
static H5I_id_info_t *H5I_find_id(hid_t id);
static int H5I_search_cb(void *obj, hid_t id, void *udata);
@@ -195,8 +199,11 @@ H5I_term_interface(void)
if(0 == n) {
for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) {
type_ptr = H5I_id_type_list_g[type];
- H5MM_xfree(type_ptr);
- H5I_id_type_list_g[type] = NULL;
+ if(type_ptr) {
+ HDassert(NULL == type_ptr->id_list);
+ type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr);
+ H5I_id_type_list_g[type] = NULL;
+ } /* end if */
} /* end for */
} /* end if */
@@ -232,15 +239,64 @@ H5I_term_interface(void)
H5I_type_t
H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func)
{
+ H5I_class_t *cls = NULL; /* New ID class */
+ H5I_type_t new_type; /* New ID type value */
H5I_type_t ret_value; /* Return value */
FUNC_ENTER_API(H5I_BADID)
H5TRACE3("It", "zIux", hash_size, reserved, free_func);
- /* Call H5I_register_type with a value of 0 to get a new type */
- ret_value = H5I_register_type((H5I_type_t)0, hash_size, reserved, free_func);
+ /* Generate a new H5I_type_t value */
+
+ /* Increment the number of types*/
+ if(H5I_next_type < H5I_MAX_NUM_TYPES) {
+ new_type = H5I_next_type;
+ H5_INC_ENUM(H5I_type_t, H5I_next_type);
+ } /* end if */
+ else {
+ hbool_t done; /* Indicate that search was successful */
+ int i; /* Local index variable */
+
+ /* Look for a free type to give out */
+ done = FALSE;
+ for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES && done == FALSE; i++) {
+ if(NULL == H5I_id_type_list_g[i]) {
+ /* Found a free type ID */
+ new_type = (H5I_type_t)i;
+ done = TRUE;
+ } /* end if */
+ } /* end for */
+
+ /* Verify that we found a type to give out */
+ if(done == FALSE)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded.")
+ } /* end else */
+
+ /* Allocate new ID class */
+ if(NULL == (cls = H5FL_MALLOC(H5I_class_t)))
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed")
+
+ /* Initialize class fields */
+ cls->type_id = new_type;
+ cls->flags = H5I_CLASS_IS_APPLICATION;
+ cls->hash_size = hash_size;
+ cls->reserved = reserved;
+ cls->free_func = free_func;
+
+ /* Register the new ID class */
+ if(H5I_register_type(cls) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_BADID, "can't initialize ID class")
+
+ /* Set return value */
+ ret_value = new_type;
done:
+ /* Clean up on error */
+ if(ret_value < 0) {
+ if(cls)
+ cls = H5FL_FREE(H5I_class_t, cls);
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Iregister_type() */
@@ -248,17 +304,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5I_register_type
*
- * Purpose: Creates a new type of ID's to give out. A specific number
- * (RESERVED) of type entries may be reserved to enable "constant"
- * values to be handed out which are valid IDs in the type, but
- * which do not map to any data structures and are not allocated
- * dynamically later. TYPE_ID is the H5I_type_t value of the type
- * to be initialized. If this value is zero, a new type is created.
- * If this value is one of the library types, that type is
- * initialized or its reference count is incremented (if it is already
- * initialized). HASH_SIZE is the minimum hash table size to
- * use for the type. FREE_FUNC is called with an object pointer
- * when the object is removed from the type.
+ * Purpose: Creates a new type of ID's to give out.
+ * The class is initialized or its reference count is incremented
+ * (if it is already initialized).
*
* Return: Success: Type ID of the new type
* Failure: H5I_BADID
@@ -269,75 +317,44 @@ done:
*
*-------------------------------------------------------------------------
*/
-H5I_type_t
-H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved,
- H5I_free_t free_func)
+herr_t
+H5I_register_type(const H5I_class_t *cls)
{
- H5I_id_type_t *type_ptr = NULL; /*ptr to the atomic type*/
- H5I_type_t ret_value = H5I_BADID; /* type ID to return */
-
- FUNC_ENTER_NOAPI(H5I_BADID)
+ H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/
+ herr_t ret_value = SUCCEED; /* Return value */
- /* Check that type_id is either a library type or zero */
- if(type_id < 0 || type_id >= H5I_NTYPES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid type ID")
-
- if(type_id == 0) { /* Generate a new H5I_type_t value */
- /* Increment the number of types*/
- if(H5I_next_type < MAX_NUM_TYPES) {
- ret_value = H5I_next_type;
- H5_INC_ENUM(H5I_type_t, H5I_next_type);
- }
- else {
- hbool_t done; /* Indicate that search was successful */
- int i; /* Local index variable */
-
- /* Look for a free type to give out */
- done = FALSE;
- for(i = H5I_NTYPES; i < MAX_NUM_TYPES && done == FALSE; i++) {
- if(NULL == H5I_id_type_list_g[i]) {
- /* Found a free type ID */
- ret_value = (H5I_type_t)i;
- done = TRUE;
- } /* end if */
- } /* end for */
+ FUNC_ENTER_NOAPI(FAIL)
- /* Verify that we found a type to give out */
- if(done == FALSE)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded.")
- } /* end else */
- } /* end if */
- else /* type_id is a library type; use this value. */
- ret_value = type_id;
+ /* Sanity check */
+ HDassert(cls);
+ HDassert(cls->type_id > 0 && cls->type_id < H5I_MAX_NUM_TYPES);
/* Initialize the type */
/* Check arguments */
#ifdef HASH_SIZE_POWER_2
- if(!POWER_OF_TWO(hash_size) || hash_size == 1)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_BADID, "invalid hash size")
+ if(!POWER_OF_TWO(cls->hash_size) || cls->hash_size == 1)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid hash size")
#endif /* HASH_SIZE_POWER_2 */
- if(NULL == H5I_id_type_list_g[ret_value]) {
+ if(NULL == H5I_id_type_list_g[cls->type_id]) {
/* Allocate the type information for new type */
- if(NULL == (type_ptr = (H5I_id_type_t *)H5MM_calloc(sizeof(H5I_id_type_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed")
- H5I_id_type_list_g[ret_value] = type_ptr;
+ if(NULL == (type_ptr = (H5I_id_type_t *)H5FL_CALLOC(H5I_id_type_t)))
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "ID type allocation failed")
+ H5I_id_type_list_g[cls->type_id] = type_ptr;
} /* end if */
else {
/* Get the pointer to the existing type */
- type_ptr = H5I_id_type_list_g[ret_value];
+ type_ptr = H5I_id_type_list_g[cls->type_id];
} /* end else */
+ /* Initialize the ID type structure for new types */
if(type_ptr->count == 0) {
- /* Initialize the ID type structure for new types */
- type_ptr->hash_size = hash_size;
- type_ptr->reserved = reserved;
+ type_ptr->cls = cls;
type_ptr->wrapped = 0;
type_ptr->ids = 0;
- type_ptr->nextid = reserved;
- type_ptr->free_func = free_func;
- type_ptr->id_list = (H5I_id_info_t **)H5MM_calloc(hash_size * sizeof(H5I_id_info_t *));
+ type_ptr->nextid = cls->reserved;
+ type_ptr->id_list = (H5I_id_info_t **)H5MM_calloc(cls->hash_size * sizeof(H5I_id_info_t *));
if(NULL == type_ptr->id_list)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_BADID, "memory allocation failed")
} /* end if */
@@ -346,10 +363,11 @@ H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved,
type_ptr->count++;
done:
- if(ret_value == H5I_BADID) { /* Clean up on error */
- if(type_ptr != NULL) {
- H5MM_xfree(type_ptr->id_list);
- H5MM_xfree(type_ptr);
+ if(ret_value < 0) { /* Clean up on error */
+ if(type_ptr) {
+ if(type_ptr->id_list)
+ H5MM_xfree(type_ptr->id_list);
+ (void)H5FL_FREE(H5I_id_type_t, type_ptr);
} /* end if */
} /* end if */
@@ -566,7 +584,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
* counts. Ignore the return value from from the free method and remove
* object from type regardless if FORCE is non-zero.
*/
- for(i = 0; i < type_ptr->hash_size; i++) {
+ for(i = 0; i < type_ptr->cls->hash_size; i++) {
H5I_id_info_t *cur; /* Current node being worked with */
H5I_id_info_t *next; /* Next node in list */
@@ -584,7 +602,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
/* Check for a 'free' function and call it, if it exists */
/* (Casting away const OK -QAK) */
- if(type_ptr->free_func && (type_ptr->free_func)((void *)cur->obj_ptr) < 0) {
+ if(type_ptr->cls->free_func && (type_ptr->cls->free_func)((void *)cur->obj_ptr) < 0) {
if(force) {
#ifdef H5I_DEBUG
if(H5DEBUG(I)) {
@@ -723,12 +741,17 @@ H5I_destroy_type(H5I_type_t type)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type")
/* Close/clear/destroy all IDs for this type */
- H5I_clear_type(type, TRUE, FALSE);
- H5E_clear_stack(NULL); /*don't care about errors*/
+ H5E_BEGIN_TRY {
+ H5I_clear_type(type, TRUE, FALSE);
+ } H5E_END_TRY /*don't care about errors*/
- H5MM_xfree(type_ptr->id_list);
+ /* Check if we should release the ID class */
+ if(type_ptr->cls->flags & H5I_CLASS_IS_APPLICATION)
+ type_ptr->cls = H5FL_FREE(H5I_class_t, (void *)type_ptr->cls);
- H5MM_free(type_ptr);
+ type_ptr->id_list = H5MM_xfree(type_ptr->id_list);
+
+ type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr);
H5I_id_type_list_g[type] = NULL;
done:
@@ -824,7 +847,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
id_ptr->next = NULL;
/* hash bucket already full, prepend to front of chain */
- hash_loc = type_ptr->nextid % (unsigned)type_ptr->hash_size;
+ hash_loc = type_ptr->nextid % (unsigned)type_ptr->cls->hash_size;
if(type_ptr->id_list[hash_loc] != NULL)
id_ptr->next = type_ptr->id_list[hash_loc];
@@ -840,7 +863,7 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
*/
if(type_ptr->nextid > (unsigned)ID_MASK) {
type_ptr->wrapped = 1;
- type_ptr->nextid = type_ptr->reserved;
+ type_ptr->nextid = type_ptr->cls->reserved;
} /* end if */
/*
@@ -854,14 +877,14 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
* we check all possible values and didn't find any free ones *then*
* we can fail.
*/
- for(i = type_ptr->reserved; i < ID_MASK; i++) {
+ for(i = type_ptr->cls->reserved; i < ID_MASK; i++) {
/* Handle end of range by wrapping to beginning */
if(type_ptr->nextid > (unsigned)ID_MASK)
- type_ptr->nextid = type_ptr->reserved;
+ type_ptr->nextid = type_ptr->cls->reserved;
/* new ID to check for */
next_id = H5I_MAKE(type, type_ptr->nextid);
- hash_loc = (unsigned)H5I_LOC(type_ptr->nextid, type_ptr->hash_size);
+ hash_loc = (unsigned)H5I_LOC(type_ptr->nextid, type_ptr->cls->hash_size);
curr_id = type_ptr->id_list[hash_loc];
if(curr_id == NULL)
break; /* Ha! this is not likely... */
@@ -1205,7 +1228,7 @@ H5I_remove(hid_t id)
HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type")
/* Get the bucket in which the ID is located */
- hash_loc = (unsigned)H5I_LOC(id, type_ptr->hash_size);
+ hash_loc = (unsigned)H5I_LOC(id, type_ptr->cls->hash_size);
curr_id = type_ptr->id_list[hash_loc];
if(NULL == curr_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID")
@@ -1336,7 +1359,7 @@ H5I_dec_ref(hid_t id)
*/
if(1 == id_ptr->count) {
/* (Casting away const OK -QAK) */
- if(!type_ptr->free_func || (type_ptr->free_func)((void *)id_ptr->obj_ptr) >= 0) {
+ if(!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) {
H5I_remove(id);
ret_value = 0;
} /* end if */
@@ -1933,13 +1956,12 @@ H5I_search_cb(void *obj, hid_t id, void *_udata)
H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */
int ret_value; /* Callback return value */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
ret_value = (*udata->app_cb)(obj, id, udata->app_key);
if(ret_value > 0)
udata->ret_obj = obj;
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_search_cb() */
@@ -2045,7 +2067,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re
unsigned u; /* Counter */
/* Start at the beginning of the array */
- for(u = 0; u < type_ptr->hash_size; u++) {
+ for(u = 0; u < type_ptr->cls->hash_size; u++) {
H5I_id_info_t *id_ptr; /* Ptr to the new ID */
id_ptr = type_ptr->id_list[u];
@@ -2110,7 +2132,7 @@ H5I_find_id(hid_t id)
HGOTO_DONE(NULL);
/* Get the bucket in which the ID is located */
- hash_loc = (unsigned)H5I_LOC(id, type_ptr->hash_size);
+ hash_loc = (unsigned)H5I_LOC(id, type_ptr->cls->hash_size);
id_ptr = type_ptr->id_list[hash_loc];
/* Scan the bucket's linked list for a match */
@@ -2297,9 +2319,9 @@ H5I_debug(H5I_type_t type)
/* Header */
fprintf(stderr, " count = %u\n", type_ptr->count);
- fprintf(stderr, " reserved = %u\n", type_ptr->reserved);
+ fprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
fprintf(stderr, " wrapped = %u\n", type_ptr->wrapped);
- fprintf(stderr, " hash_size = %lu\n", (unsigned long)type_ptr->hash_size);
+ fprintf(stderr, " hash_size = %lu\n", (unsigned long)type_ptr->cls->hash_size);
fprintf(stderr, " ids = %u\n", type_ptr->ids);
fprintf(stderr, " nextid = %u\n", type_ptr->nextid);
diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h
index f17a4b0..dc8e867 100644
--- a/src/H5Ipkg.h
+++ b/src/H5Ipkg.h
@@ -46,7 +46,7 @@
#define TYPE_BITS 7
#define TYPE_MASK ((1<<TYPE_BITS)-1)
-#define MAX_NUM_TYPES TYPE_MASK
+#define H5I_MAX_NUM_TYPES TYPE_MASK
/*
* Number of bits to use for the Atom index in each atom (assumes 8-bit
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index bc0ef41..ff1463d 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -28,29 +28,45 @@
/* Private headers needed by this file */
#include "H5private.h"
+/**************************/
+/* Library Private Macros */
+/**************************/
+
/* Macro to determine if a H5I_type_t is a "library type" */
#define H5I_IS_LIB_TYPE( type ) (type > 0 && type < H5I_NTYPES)
-/* Default sizes of the hash-tables for various atom types */
-#define H5I_ERRSTACK_HASHSIZE 64
-#define H5I_FILEID_HASHSIZE 64
-#define H5I_TEMPID_HASHSIZE 64
-#define H5I_DATATYPEID_HASHSIZE 64
-#define H5I_DATASPACEID_HASHSIZE 64
-#define H5I_DATASETID_HASHSIZE 64
-#define H5I_OID_HASHSIZE 64
-#define H5I_GROUPID_HASHSIZE 64
-#define H5I_ATTRID_HASHSIZE 64
-#define H5I_REFID_HASHSIZE 64
-#define H5I_VFL_HASHSIZE 64
-#define H5I_GENPROPCLS_HASHSIZE 64
-#define H5I_GENPROPOBJ_HASHSIZE 128
-#define H5I_ERRCLS_HASHSIZE 64
-#define H5I_ERRMSG_HASHSIZE 64
-#define H5I_ERRSTK_HASHSIZE 64
-
-/* Private Functions in H5I.c */
-H5_DLL H5I_type_t H5I_register_type(H5I_type_t type_id, size_t hash_size, unsigned reserved, H5I_free_t free_func);
+/* Flags for ID class */
+#define H5I_CLASS_IS_APPLICATION 0x01
+
+
+/****************************/
+/* Library Private Typedefs */
+/****************************/
+
+typedef struct H5I_class_t {
+ H5I_type_t type_id; /* Class ID for the type */
+ unsigned flags; /* Class behavior flags */
+ size_t hash_size; /* Minimum hash table size for the type */
+ unsigned reserved; /* Number of reserved IDs for this type */
+ /* [A specific number of type entries may be
+ * reserved to enable "constant" values to be
+ * handed out which are valid IDs in the type,
+ * but which do not map to any data structures
+ * and are not allocated dynamically later.]
+ */
+ H5I_free_t free_func; /* Free function for object's of this type */
+} H5I_class_t;
+
+
+/*****************************/
+/* Library-private Variables */
+/*****************************/
+
+
+/***************************************/
+/* Library-private Function Prototypes */
+/***************************************/
+H5_DLL herr_t H5I_register_type(const H5I_class_t *cls);
H5_DLL int H5I_nmembers(H5I_type_t type);
H5_DLL herr_t H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref);
H5_DLL int H5I_destroy_type(H5I_type_t type);
diff --git a/src/H5Pint.c b/src/H5Pint.c
index b216ab3..dae7b08 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -38,6 +38,7 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
+
/****************/
/* Local Macros */
/****************/
@@ -236,6 +237,25 @@ H5FL_DEFINE_STATIC(H5P_genprop_t);
/* Declare a free list to manage the H5P_genplist_t struct */
H5FL_DEFINE_STATIC(H5P_genplist_t);
+/* Generic Property Class ID class */
+static const H5I_class_t H5I_GENPROPCLS_CLS[1] = {{
+ H5I_GENPROP_CLS, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5P_close_class /* Callback routine for closing objects of this class */
+}};
+
+/* Generic Property List ID class */
+static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{
+ H5I_GENPROP_LST, /* ID class value */
+ 0, /* Class flags */
+ 128, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5P_close /* Callback routine for closing objects of this class */
+}};
+
+
/*--------------------------------------------------------------------------
NAME
@@ -357,9 +377,9 @@ H5P_init_interface(void)
/*
* Initialize the Generic Property class & object groups.
*/
- if(H5I_register_type(H5I_GENPROP_CLS, (size_t)H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0)
+ if(H5I_register_type(H5I_GENPROPCLS_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
- if(H5I_register_type(H5I_GENPROP_LST, (size_t)H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close) < 0)
+ if(H5I_register_type(H5I_GENPROPLST_CLS) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group")
/* Repeatedly pass over the list of property list classes for the library,
diff --git a/src/H5R.c b/src/H5R.c
index 57eab83..8fac4bf 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -13,12 +13,19 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5R_PACKAGE /*suppress error about including H5Rpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5R_init_interface
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Dprivate.h" /* Datasets */
@@ -30,18 +37,52 @@
#include "H5Rpkg.h" /* References */
#include "H5Sprivate.h" /* Dataspaces */
-/* Local macro definitions */
-/* Number of reserved IDs in ID group */
-#define H5R_RESERVED_ATOMS 0
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Static functions */
static herr_t H5R_create(void *ref, H5G_loc_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref);
static ssize_t H5R_get_name(H5F_t *file, hid_t lapl_id, hid_t dxpl_id, hid_t id,
H5R_type_t ref_type, const void *_ref, char *name, size_t size);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Reference ID class */
+static const H5I_class_t H5I_REFERENCE_CLS[1] = {{
+ H5I_REFERENCE, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 0, /* # of reserved IDs for class */
+ NULL /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5R_init
@@ -89,7 +130,7 @@ H5R_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the file IDs */
- if(H5I_register_type(H5I_REFERENCE, (size_t)H5I_REFID_HASHSIZE, H5R_RESERVED_ATOMS, (H5I_free_t)NULL) < 0)
+ if(H5I_register_type(H5I_REFERENCE_CLS) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface");
done:
diff --git a/src/H5S.c b/src/H5S.c
index 5d99066..7ef1da4 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -13,12 +13,19 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5S_PACKAGE /*suppress error about including H5Spkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5S_init_interface
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
@@ -28,26 +35,48 @@
#include "H5Oprivate.h" /* Object headers */
#include "H5Spkg.h" /* Dataspaces */
-/* Local macro definitions */
-/* Number of reserved IDs in ID group */
-#define H5S_RESERVED_ATOMS 2
+/****************/
+/* Local Macros */
+/****************/
/* Version of datatype encoding */
#define H5S_ENCODE_VERSION 0
-/* Local static function prototypes */
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank,
const hsize_t *dims, const hsize_t *max);
static htri_t H5S_is_simple(const H5S_t *sdim);
static herr_t H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc);
static H5S_t *H5S_decode(const unsigned char *buf);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
#ifdef H5_HAVE_PARALLEL
/* Global vars whose value can be set from environment variable also */
hbool_t H5S_mpi_opt_types_g = TRUE;
#endif /* H5_HAVE_PARALLEL */
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/* Declare a free list to manage the H5S_extent_t struct */
H5FL_DEFINE(H5S_extent_t);
@@ -57,6 +86,16 @@ H5FL_DEFINE(H5S_t);
/* Declare a free list to manage the array's of hsize_t's */
H5FL_ARR_DEFINE(hsize_t,H5S_MAX_RANK);
+/* Dataspace ID class */
+static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
+ H5I_DATASPACE, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 2, /* # of reserved IDs for class */
+ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
+}};
+
+
/*--------------------------------------------------------------------------
NAME
@@ -78,7 +117,7 @@ H5S_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the file IDs */
- if(H5I_register_type(H5I_DATASPACE, (size_t)H5I_DATASPACEID_HASHSIZE, H5S_RESERVED_ATOMS, (H5I_free_t)H5S_close) < 0)
+ if(H5I_register_type(H5I_DATASPACE_CLS) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize interface")
#ifdef H5_HAVE_PARALLEL
diff --git a/src/H5T.c b/src/H5T.c
index 73a1470..b2d97bc 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -51,233 +51,11 @@
#include <sys/fpu.h>
#endif /* H5_HAVE_SYS_FPU_H */
-/*
- * Predefined data types. These are initialized at runtime in H5Tinit.c and
- * by H5T_init_interface() in this source file.
- *
- * If more of these are added, the new ones must be added to the list of
- * types to reset in H5T_term_interface().
- */
-hid_t H5T_IEEE_F32BE_g = FAIL;
-hid_t H5T_IEEE_F32LE_g = FAIL;
-hid_t H5T_IEEE_F64BE_g = FAIL;
-hid_t H5T_IEEE_F64LE_g = FAIL;
-
-hid_t H5T_VAX_F32_g = FAIL;
-hid_t H5T_VAX_F64_g = FAIL;
-
-hid_t H5T_STD_I8BE_g = FAIL;
-hid_t H5T_STD_I8LE_g = FAIL;
-hid_t H5T_STD_I16BE_g = FAIL;
-hid_t H5T_STD_I16LE_g = FAIL;
-hid_t H5T_STD_I32BE_g = FAIL;
-hid_t H5T_STD_I32LE_g = FAIL;
-hid_t H5T_STD_I64BE_g = FAIL;
-hid_t H5T_STD_I64LE_g = FAIL;
-hid_t H5T_STD_U8BE_g = FAIL;
-hid_t H5T_STD_U8LE_g = FAIL;
-hid_t H5T_STD_U16BE_g = FAIL;
-hid_t H5T_STD_U16LE_g = FAIL;
-hid_t H5T_STD_U32BE_g = FAIL;
-hid_t H5T_STD_U32LE_g = FAIL;
-hid_t H5T_STD_U64BE_g = FAIL;
-hid_t H5T_STD_U64LE_g = FAIL;
-hid_t H5T_STD_B8BE_g = FAIL;
-hid_t H5T_STD_B8LE_g = FAIL;
-hid_t H5T_STD_B16BE_g = FAIL;
-hid_t H5T_STD_B16LE_g = FAIL;
-hid_t H5T_STD_B32BE_g = FAIL;
-hid_t H5T_STD_B32LE_g = FAIL;
-hid_t H5T_STD_B64BE_g = FAIL;
-hid_t H5T_STD_B64LE_g = FAIL;
-hid_t H5T_STD_REF_OBJ_g = FAIL;
-hid_t H5T_STD_REF_DSETREG_g = FAIL;
-hid_t H5T_UNIX_D32BE_g = FAIL;
-hid_t H5T_UNIX_D32LE_g = FAIL;
-hid_t H5T_UNIX_D64BE_g = FAIL;
-hid_t H5T_UNIX_D64LE_g = FAIL;
-
-hid_t H5T_C_S1_g = FAIL;
-
-hid_t H5T_FORTRAN_S1_g = FAIL;
-
-hid_t H5T_NATIVE_SCHAR_g = FAIL;
-hid_t H5T_NATIVE_UCHAR_g = FAIL;
-hid_t H5T_NATIVE_SHORT_g = FAIL;
-hid_t H5T_NATIVE_USHORT_g = FAIL;
-hid_t H5T_NATIVE_INT_g = FAIL;
-hid_t H5T_NATIVE_UINT_g = FAIL;
-hid_t H5T_NATIVE_LONG_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
-hid_t H5T_NATIVE_LLONG_g = FAIL;
-hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_FLOAT_g = FAIL;
-hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-#if H5_SIZEOF_LONG_DOUBLE !=0
-hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
-#endif
-hid_t H5T_NATIVE_B8_g = FAIL;
-hid_t H5T_NATIVE_B16_g = FAIL;
-hid_t H5T_NATIVE_B32_g = FAIL;
-hid_t H5T_NATIVE_B64_g = FAIL;
-hid_t H5T_NATIVE_OPAQUE_g = FAIL;
-hid_t H5T_NATIVE_HADDR_g = FAIL;
-hid_t H5T_NATIVE_HSIZE_g = FAIL;
-hid_t H5T_NATIVE_HSSIZE_g = FAIL;
-hid_t H5T_NATIVE_HERR_g = FAIL;
-hid_t H5T_NATIVE_HBOOL_g = FAIL;
-
-hid_t H5T_NATIVE_INT8_g = FAIL;
-hid_t H5T_NATIVE_UINT8_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST8_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST8_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST8_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST8_g = FAIL;
-
-hid_t H5T_NATIVE_INT16_g = FAIL;
-hid_t H5T_NATIVE_UINT16_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST16_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST16_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST16_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST16_g = FAIL;
-
-hid_t H5T_NATIVE_INT32_g = FAIL;
-hid_t H5T_NATIVE_UINT32_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST32_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST32_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST32_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST32_g = FAIL;
-
-hid_t H5T_NATIVE_INT64_g = FAIL;
-hid_t H5T_NATIVE_UINT64_g = FAIL;
-hid_t H5T_NATIVE_INT_LEAST64_g = FAIL;
-hid_t H5T_NATIVE_UINT_LEAST64_g = FAIL;
-hid_t H5T_NATIVE_INT_FAST64_g = FAIL;
-hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
-
-/*
- * Alignment constraints for native types. These are initialized at run time
- * in H5Tinit.c. These alignments are mainly for offsets in HDF5 compound
- * datatype or C structures, which are different from the alignments for memory
- * address below this group of variables.
- */
-size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE !=0
-size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 0;
-#endif
-
-size_t H5T_POINTER_COMP_ALIGN_g = 0;
-size_t H5T_HVL_COMP_ALIGN_g = 0;
-size_t H5T_HOBJREF_COMP_ALIGN_g = 0;
-size_t H5T_HDSETREGREF_COMP_ALIGN_g = 0;
-
-/*
- * Alignment constraints for native types. These are initialized at run time
- * in H5Tinit.c
- */
-size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE !=0
-size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
-#endif
-
-/*
- * Alignment constraints for C9x types. These are initialized at run time in
- * H5Tinit.c if the types are provided by the system. Otherwise we set their
- * values to 0 here (no alignment calculated).
- */
-size_t H5T_NATIVE_INT8_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT8_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_LEAST8_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_LEAST8_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_FAST8_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_FAST8_ALIGN_g = 0;
-
-size_t H5T_NATIVE_INT16_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT16_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_LEAST16_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_LEAST16_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_FAST16_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_FAST16_ALIGN_g = 0;
-
-size_t H5T_NATIVE_INT32_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT32_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_LEAST32_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_LEAST32_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_FAST32_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_FAST32_ALIGN_g = 0;
-
-size_t H5T_NATIVE_INT64_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT64_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_LEAST64_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_LEAST64_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_FAST64_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
-
-/* Useful floating-point values for conversion routines */
-/* (+/- Inf for all floating-point types) */
-float H5T_NATIVE_FLOAT_POS_INF_g = 0.0;
-float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0;
-double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
-double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
-
-
-/*
- * The path database. Each path has a source and destination data type pair
- * which is used as the key by which the `entries' array is sorted.
- */
-static struct {
- int npaths; /*number of paths defined */
- size_t apaths; /*number of paths allocated */
- H5T_path_t **path; /*sorted array of path pointers */
- int nsoft; /*number of soft conversions defined */
- size_t asoft; /*number of soft conversions allocated */
- H5T_soft_t *soft; /*unsorted array of soft conversions */
-} H5T_g;
-
-/* The native endianess of the platform */
-H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR;
-
-/* Declare the free list for H5T_t's and H5T_shared_t's */
-H5FL_DEFINE(H5T_t);
-H5FL_DEFINE(H5T_shared_t);
-
-/* Declare the free list for H5T_path_t's */
-H5FL_DEFINE(H5T_path_t);
-
-/* Static local functions */
-static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src,
- H5T_t *dst, H5T_conv_t func, hid_t dxpl_id);
-static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src,
- H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call);
-static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst);
-static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
-static H5T_t *H5T_decode(const unsigned char *buf);
-static herr_t H5T_set_size(H5T_t *dt, size_t size);
+/****************/
+/* Local Macros */
+/****************/
-/* Local macro definitions */
#define H5T_ENCODE_VERSION 0
/*
@@ -500,6 +278,264 @@ static herr_t H5T_set_size(H5T_t *dt, size_t size);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \
}
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src,
+ H5T_t *dst, H5T_conv_t func, hid_t dxpl_id);
+static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src,
+ H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call);
+static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst);
+static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
+static H5T_t *H5T_decode(const unsigned char *buf);
+static herr_t H5T_set_size(H5T_t *dt, size_t size);
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/* The native endianess of the platform */
+H5T_order_t H5T_native_order_g = H5T_ORDER_ERROR;
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*
+ * Predefined data types. These are initialized at runtime in H5Tinit.c and
+ * by H5T_init_interface() in this source file.
+ *
+ * If more of these are added, the new ones must be added to the list of
+ * types to reset in H5T_term_interface().
+ */
+hid_t H5T_IEEE_F32BE_g = FAIL;
+hid_t H5T_IEEE_F32LE_g = FAIL;
+hid_t H5T_IEEE_F64BE_g = FAIL;
+hid_t H5T_IEEE_F64LE_g = FAIL;
+
+hid_t H5T_VAX_F32_g = FAIL;
+hid_t H5T_VAX_F64_g = FAIL;
+
+hid_t H5T_STD_I8BE_g = FAIL;
+hid_t H5T_STD_I8LE_g = FAIL;
+hid_t H5T_STD_I16BE_g = FAIL;
+hid_t H5T_STD_I16LE_g = FAIL;
+hid_t H5T_STD_I32BE_g = FAIL;
+hid_t H5T_STD_I32LE_g = FAIL;
+hid_t H5T_STD_I64BE_g = FAIL;
+hid_t H5T_STD_I64LE_g = FAIL;
+hid_t H5T_STD_U8BE_g = FAIL;
+hid_t H5T_STD_U8LE_g = FAIL;
+hid_t H5T_STD_U16BE_g = FAIL;
+hid_t H5T_STD_U16LE_g = FAIL;
+hid_t H5T_STD_U32BE_g = FAIL;
+hid_t H5T_STD_U32LE_g = FAIL;
+hid_t H5T_STD_U64BE_g = FAIL;
+hid_t H5T_STD_U64LE_g = FAIL;
+hid_t H5T_STD_B8BE_g = FAIL;
+hid_t H5T_STD_B8LE_g = FAIL;
+hid_t H5T_STD_B16BE_g = FAIL;
+hid_t H5T_STD_B16LE_g = FAIL;
+hid_t H5T_STD_B32BE_g = FAIL;
+hid_t H5T_STD_B32LE_g = FAIL;
+hid_t H5T_STD_B64BE_g = FAIL;
+hid_t H5T_STD_B64LE_g = FAIL;
+hid_t H5T_STD_REF_OBJ_g = FAIL;
+hid_t H5T_STD_REF_DSETREG_g = FAIL;
+
+hid_t H5T_UNIX_D32BE_g = FAIL;
+hid_t H5T_UNIX_D32LE_g = FAIL;
+hid_t H5T_UNIX_D64BE_g = FAIL;
+hid_t H5T_UNIX_D64LE_g = FAIL;
+
+hid_t H5T_C_S1_g = FAIL;
+
+hid_t H5T_FORTRAN_S1_g = FAIL;
+
+hid_t H5T_NATIVE_SCHAR_g = FAIL;
+hid_t H5T_NATIVE_UCHAR_g = FAIL;
+hid_t H5T_NATIVE_SHORT_g = FAIL;
+hid_t H5T_NATIVE_USHORT_g = FAIL;
+hid_t H5T_NATIVE_INT_g = FAIL;
+hid_t H5T_NATIVE_UINT_g = FAIL;
+hid_t H5T_NATIVE_LONG_g = FAIL;
+hid_t H5T_NATIVE_ULONG_g = FAIL;
+hid_t H5T_NATIVE_LLONG_g = FAIL;
+hid_t H5T_NATIVE_ULLONG_g = FAIL;
+hid_t H5T_NATIVE_FLOAT_g = FAIL;
+hid_t H5T_NATIVE_DOUBLE_g = FAIL;
+#if H5_SIZEOF_LONG_DOUBLE !=0
+hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
+#endif
+hid_t H5T_NATIVE_B8_g = FAIL;
+hid_t H5T_NATIVE_B16_g = FAIL;
+hid_t H5T_NATIVE_B32_g = FAIL;
+hid_t H5T_NATIVE_B64_g = FAIL;
+hid_t H5T_NATIVE_OPAQUE_g = FAIL;
+hid_t H5T_NATIVE_HADDR_g = FAIL;
+hid_t H5T_NATIVE_HSIZE_g = FAIL;
+hid_t H5T_NATIVE_HSSIZE_g = FAIL;
+hid_t H5T_NATIVE_HERR_g = FAIL;
+hid_t H5T_NATIVE_HBOOL_g = FAIL;
+
+hid_t H5T_NATIVE_INT8_g = FAIL;
+hid_t H5T_NATIVE_UINT8_g = FAIL;
+hid_t H5T_NATIVE_INT_LEAST8_g = FAIL;
+hid_t H5T_NATIVE_UINT_LEAST8_g = FAIL;
+hid_t H5T_NATIVE_INT_FAST8_g = FAIL;
+hid_t H5T_NATIVE_UINT_FAST8_g = FAIL;
+
+hid_t H5T_NATIVE_INT16_g = FAIL;
+hid_t H5T_NATIVE_UINT16_g = FAIL;
+hid_t H5T_NATIVE_INT_LEAST16_g = FAIL;
+hid_t H5T_NATIVE_UINT_LEAST16_g = FAIL;
+hid_t H5T_NATIVE_INT_FAST16_g = FAIL;
+hid_t H5T_NATIVE_UINT_FAST16_g = FAIL;
+
+hid_t H5T_NATIVE_INT32_g = FAIL;
+hid_t H5T_NATIVE_UINT32_g = FAIL;
+hid_t H5T_NATIVE_INT_LEAST32_g = FAIL;
+hid_t H5T_NATIVE_UINT_LEAST32_g = FAIL;
+hid_t H5T_NATIVE_INT_FAST32_g = FAIL;
+hid_t H5T_NATIVE_UINT_FAST32_g = FAIL;
+
+hid_t H5T_NATIVE_INT64_g = FAIL;
+hid_t H5T_NATIVE_UINT64_g = FAIL;
+hid_t H5T_NATIVE_INT_LEAST64_g = FAIL;
+hid_t H5T_NATIVE_UINT_LEAST64_g = FAIL;
+hid_t H5T_NATIVE_INT_FAST64_g = FAIL;
+hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
+
+/*
+ * Alignment constraints for native types. These are initialized at run time
+ * in H5Tinit.c. These alignments are mainly for offsets in HDF5 compound
+ * datatype or C structures, which are different from the alignments for memory
+ * address below this group of variables.
+ */
+size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
+#if H5_SIZEOF_LONG_DOUBLE !=0
+size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 0;
+#endif
+
+size_t H5T_POINTER_COMP_ALIGN_g = 0;
+size_t H5T_HVL_COMP_ALIGN_g = 0;
+size_t H5T_HOBJREF_COMP_ALIGN_g = 0;
+size_t H5T_HDSETREGREF_COMP_ALIGN_g = 0;
+
+/*
+ * Alignment constraints for native types. These are initialized at run time
+ * in H5Tinit.c
+ */
+size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
+#if H5_SIZEOF_LONG_DOUBLE !=0
+size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
+#endif
+
+/*
+ * Alignment constraints for C9x types. These are initialized at run time in
+ * H5Tinit.c if the types are provided by the system. Otherwise we set their
+ * values to 0 here (no alignment calculated).
+ */
+size_t H5T_NATIVE_INT8_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT8_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_LEAST8_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_LEAST8_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_FAST8_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_FAST8_ALIGN_g = 0;
+
+size_t H5T_NATIVE_INT16_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT16_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_LEAST16_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_LEAST16_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_FAST16_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_FAST16_ALIGN_g = 0;
+
+size_t H5T_NATIVE_INT32_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT32_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_LEAST32_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_LEAST32_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_FAST32_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_FAST32_ALIGN_g = 0;
+
+size_t H5T_NATIVE_INT64_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT64_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_LEAST64_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_LEAST64_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_FAST64_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
+
+/* Useful floating-point values for conversion routines */
+/* (+/- Inf for all floating-point types) */
+float H5T_NATIVE_FLOAT_POS_INF_g = 0.0;
+float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0;
+double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
+double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
+
+/* Declare the free list for H5T_t's and H5T_shared_t's */
+H5FL_DEFINE(H5T_t);
+H5FL_DEFINE(H5T_shared_t);
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*
+ * The path database. Each path has a source and destination data type pair
+ * which is used as the key by which the `entries' array is sorted.
+ */
+static struct {
+ int npaths; /*number of paths defined */
+ size_t apaths; /*number of paths allocated */
+ H5T_path_t **path; /*sorted array of path pointers */
+ int nsoft; /*number of soft conversions defined */
+ size_t asoft; /*number of soft conversions allocated */
+ H5T_soft_t *soft; /*unsorted array of soft conversions */
+} H5T_g;
+
+/* Declare the free list for H5T_path_t's */
+H5FL_DEFINE_STATIC(H5T_path_t);
+
+/* Datatype ID class */
+static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
+ H5I_DATATYPE, /* ID class value */
+ 0, /* Class flags */
+ 64, /* Minimum hash size for class */
+ 8, /* # of reserved IDs for class */
+ (H5I_free_t)H5T_close /* Callback routine for closing objects of this class */
+}};
+
+
/*-------------------------------------------------------------------------
* Function: H5T_init
@@ -743,7 +779,7 @@ H5T_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
/* Initialize the atom group for the file IDs */
- if(H5I_register_type(H5I_DATATYPE, (size_t)H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0)
+ if(H5I_register_type(H5I_DATATYPE_CLS) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface")
/* Make certain there aren't too many classes of datatypes defined */
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 6736920..b9364d6 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -46,9 +46,6 @@
/* Other public headers needed by this file */
#include "H5Spublic.h" /* Dataspace functions */
-/* Number of reserved IDs in ID group */
-#define H5T_RESERVED_ATOMS 8
-
/* Length of debugging name buffer */
#define H5T_NAMELEN 32
diff --git a/test/tid.c b/test/tid.c
index 97b28ca..87f3d37 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -451,11 +451,11 @@ out:
/* Test boundary cases with lots of types */
-/* Type IDs range from H5I_NTYPES to MAX_NUM_TYPES. The system will assign */
-/* IDs in sequential order until MAX_NUM_TYPES IDs have been given out, at which */
+/* Type IDs range from H5I_NTYPES to H5I_MAX_NUM_TYPES. The system will assign */
+/* IDs in sequential order until H5I_MAX_NUM_TYPES IDs have been given out, at which */
/* point it will search for type IDs that were allocated but have since been */
/* deleted. */
-/* This test will allocate IDs up to MAX_NUM_TYPES, ensure that IDs wrap around */
+/* This test will allocate IDs up to H5I_MAX_NUM_TYPES, ensure that IDs wrap around */
/* to low values successfully, ensure that an error is thrown when all possible */
/* type IDs are taken, then ensure that deleting types frees up their IDs. */
/* Note that this test depends on the implementation of IDs, so may break */
@@ -463,7 +463,7 @@ out:
/* Also note that if someone else registered a user-defined type and forgot to */
/* destroy it, this test will mysteriously fail (because it will expect there to */
/* be one more "free" type ID than there is). */
-/* H5I_NTYPES is defined in h5public.h, MAX_NUM_TYPES is defined in h5pkg.h */
+/* H5I_NTYPES is defined in h5public.h, H5I_MAX_NUM_TYPES is defined in h5pkg.h */
static int test_id_type_list(void)
{
H5I_type_t startType; /* The first type ID we were assigned in this test */
@@ -477,14 +477,14 @@ static int test_id_type_list(void)
goto out;
/* Sanity check */
- if(startType >= MAX_NUM_TYPES || startType < H5I_NTYPES)
+ if(startType >= H5I_MAX_NUM_TYPES || startType < H5I_NTYPES)
{
/* Error condition, throw an error */
CHECK(1, 1, "H5Iregister_type");
goto out;
}
- /* Create types up to MAX_NUM_TYPES */
- for(i = startType + 1; i < MAX_NUM_TYPES; i++)
+ /* Create types up to H5I_MAX_NUM_TYPES */
+ for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++)
{
currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
CHECK(currentType, H5I_BADID, "H5Iregister_type");
@@ -519,7 +519,7 @@ static int test_id_type_list(void)
goto out;
/* Cleanup. Destroy all types. */
- for(i = H5I_NTYPES; i < MAX_NUM_TYPES; i++)
+ for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
H5Idestroy_type((H5I_type_t) i);
return 0;
@@ -527,7 +527,7 @@ static int test_id_type_list(void)
out:
/* Cleanup. For simplicity, just destroy all types and ignore errors. */
H5E_BEGIN_TRY
- for(i = H5I_NTYPES; i < MAX_NUM_TYPES; i++)
+ for(i = H5I_NTYPES; i < H5I_MAX_NUM_TYPES; i++)
H5Idestroy_type((H5I_type_t) i);
H5E_END_TRY
return -1;