summaryrefslogtreecommitdiffstats
path: root/src/H5Iint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-11-23 16:18:26 (GMT)
committerGitHub <noreply@github.com>2020-11-23 16:18:26 (GMT)
commit5ff09ae971cdb8a85c596520666c8dc178541e4a (patch)
tree56cd3f440387a7bd29938a8fc150a2073bc50e19 /src/H5Iint.c
parentd4a3097ec5d9e44d377c4b91a05b3e0c5f9f1e2c (diff)
downloadhdf5-5ff09ae971cdb8a85c596520666c8dc178541e4a.zip
hdf5-5ff09ae971cdb8a85c596520666c8dc178541e4a.tar.gz
hdf5-5ff09ae971cdb8a85c596520666c8dc178541e4a.tar.bz2
Basic alignment with async branch (#115)
* Basic alignment with async branch - trivial changes to reduce clutter in overall diff. * Update minor error code to reflect change within library * Update the error output to match library
Diffstat (limited to 'src/H5Iint.c')
-rw-r--r--src/H5Iint.c128
1 files changed, 62 insertions, 66 deletions
diff --git a/src/H5Iint.c b/src/H5Iint.c
index fa08253..2e1145d 100644
--- a/src/H5Iint.c
+++ b/src/H5Iint.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
+/*
* H5Iint.c - Private routines for handling IDs
*/
@@ -62,8 +62,8 @@ typedef struct {
/* User data for H5I__clear_type_cb */
typedef struct {
H5I_type_info_t *type_info; /* Pointer to the type's info to be cleared */
- hbool_t force; /* Whether to always remove the ID */
- hbool_t app_ref; /* Whether this is an appl. ref. call */
+ hbool_t force; /* Whether to always remove the ID */
+ hbool_t app_ref; /* Whether this is an appl. ref. call */
} H5I_clear_type_ud_t;
/********************/
@@ -74,10 +74,10 @@ typedef struct {
/* Local Prototypes */
/********************/
-static void * H5I__unwrap(void *object, H5I_type_t type);
-static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
-static void * H5I__remove_common(H5I_type_info_t *type_info, hid_t id);
-static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
+static void * H5I__unwrap(void *object, H5I_type_t type);
+static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata);
+static void * H5I__remove_common(H5I_type_info_t *type_info, hid_t id);
+static int H5I__find_id_cb(void *_item, void *_key, void *_udata);
/*********************/
/* Package Variables */
@@ -88,7 +88,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Declared extern in H5Ipkg.h and documented there */
H5I_type_info_t *H5I_type_info_array_g[H5I_MAX_NUM_TYPES];
-int H5I_next_type_g = (int)H5I_NTYPES;
+int H5I_next_type_g = (int)H5I_NTYPES;
/* Declare a free list to manage the H5I_id_info_t struct */
H5FL_DEFINE_STATIC(H5I_id_info_t);
@@ -101,7 +101,6 @@ H5FL_DEFINE_STATIC(H5I_id_info_t);
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5I_term_package
*
@@ -125,7 +124,7 @@ H5I_term_package(void)
if (H5_PKG_INIT_VAR) {
H5I_type_info_t *type_info = NULL; /* Pointer to ID type */
- int i;
+ int i;
/* Count the number of types still in use */
for (i = 0; i < H5I_next_type_g; i++)
@@ -138,7 +137,7 @@ H5I_term_package(void)
type_info = H5I_type_info_array_g[i];
if (type_info) {
HDassert(NULL == type_info->ids);
- type_info = H5MM_xfree(type_info);
+ type_info = H5MM_xfree(type_info);
H5I_type_info_array_g[i] = NULL;
in_use++;
}
@@ -167,8 +166,8 @@ H5I_term_package(void)
herr_t
H5I_register_type(const H5I_class_t *cls)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the ID type*/
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type*/
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -190,9 +189,9 @@ H5I_register_type(const H5I_class_t *cls)
/* Initialize the ID type structure for new types */
if (type_info->init_count == 0) {
- type_info->cls = cls;
- type_info->id_count = 0;
- type_info->nextid = cls->reserved;
+ type_info->cls = cls;
+ type_info->id_count = 0;
+ type_info->nextid = cls->reserved;
type_info->last_id_info = NULL;
if (NULL == (type_info->ids = H5SL_create(H5SL_TYPE_HID, NULL)))
HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed")
@@ -233,7 +232,7 @@ int64_t
H5I_nmembers(H5I_type_t type)
{
H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
- int64_t ret_value = 0; /* Return value */
+ int64_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -309,8 +308,8 @@ H5I__unwrap(void *object, H5I_type_t type)
herr_t
H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref)
{
- H5I_clear_type_ud_t udata; /* udata struct for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_clear_type_ud_t udata; /* udata struct for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -350,7 +349,7 @@ done:
static htri_t
H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
{
- H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */
+ H5I_id_info_t * info = (H5I_id_info_t *)_info; /* Current ID info being worked with */
H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */
htri_t ret_value = FALSE; /* Return value */
@@ -420,8 +419,8 @@ H5I__clear_type_cb(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
herr_t
H5I__destroy_type(H5I_type_t type)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -473,10 +472,10 @@ done:
hid_t
H5I_register(H5I_type_t type, const void *object, hbool_t app_ref)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- H5I_id_info_t *info = NULL; /* Pointer to the new ID information */
- hid_t new_id = H5I_INVALID_HID; /* New ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * info = NULL; /* Pointer to the new ID information */
+ hid_t new_id = H5I_INVALID_HID; /* New ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -536,9 +535,9 @@ done:
herr_t
H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- H5I_id_info_t *info = NULL; /* Pointer to the new ID information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * info = NULL; /* Pointer to the new ID information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -602,7 +601,7 @@ done:
void *
H5I_subst(hid_t id, const void *new_object)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID's info */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID's info */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -638,7 +637,7 @@ done:
void *
H5I_object(hid_t id)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOERR
@@ -821,7 +820,7 @@ H5I__remove_verify(hid_t id, H5I_type_t type)
static void *
H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
{
- H5I_id_info_t *info = NULL; /* Pointer to the current ID */
+ H5I_id_info_t *info = NULL; /* Pointer to the current ID */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -841,7 +840,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
H5_GCC_DIAG_ON("cast-qual")
- info = H5FL_FREE(H5I_id_info_t, info);
+ info = H5FL_FREE(H5I_id_info_t, info);
/* Decrement the number of IDs in the type */
(type_info->id_count)--;
@@ -865,9 +864,9 @@ done:
void *
H5I_remove(hid_t id)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
- H5I_type_t type = H5I_BADID; /* ID's type */
- void * ret_value = NULL; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
+ H5I_type_t type = H5I_BADID; /* ID's type */
+ void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -897,7 +896,6 @@ done:
* function has been defined at type creation time.
*
* Return: Success: New reference count
- *
* Failure: -1
*
*-------------------------------------------------------------------------
@@ -905,8 +903,8 @@ done:
int
H5I_dec_ref(hid_t id)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID */
- int ret_value = 0; /* Return value */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -944,15 +942,15 @@ H5I_dec_ref(hid_t id)
if (NULL == H5I__remove_common(type_info, id))
HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node")
ret_value = 0;
- }
+ } /* end if */
else
ret_value = -1;
H5_GCC_DIAG_ON("cast-qual")
- }
+ } /* end if */
else {
--(info->count);
ret_value = (int)info->count;
- }
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -961,7 +959,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5I_dec_app_ref
*
- * Purpose: H5I_dec_ref wrapper for case of modifying the application ref.
+ * Purpose: Wrapper for case of modifying the application ref.
* count for an ID as well as normal reference count.
*
* Return: Success: New app. reference count
@@ -975,8 +973,7 @@ done:
int
H5I_dec_app_ref(hid_t id)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID info */
- int ret_value = 0; /* Return value */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -989,6 +986,8 @@ H5I_dec_app_ref(hid_t id)
/* Check if the ID still exists */
if (ret_value > 0) {
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+
/* General lookup of the ID */
if (NULL == (info = H5I__find_id(id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID")
@@ -999,7 +998,7 @@ H5I_dec_app_ref(hid_t id)
/* Set return value */
ret_value = (int)info->app_count;
- }
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1008,8 +1007,8 @@ done:
/*-------------------------------------------------------------------------
* Function: H5I_dec_app_ref_always_close
*
- * Purpose: H5I_dec_app_ref wrapper for case of always closing the ID,
- * even when the free routine fails
+ * Purpose: Wrapper for case of always closing the ID, even when the free
+ * routine fails
*
* Return: Success: New app. reference count
* Failure: -1
@@ -1059,8 +1058,8 @@ done:
int
H5I_inc_ref(hid_t id, hbool_t app_ref)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID info */
- int ret_value = 0; /* Return value */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID info */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -1096,8 +1095,8 @@ done:
int
H5I_get_ref(hid_t id, hbool_t app_ref)
{
- H5I_id_info_t *info = NULL; /* Pointer to the ID */
- int ret_value = 0; /* Return value */
+ H5I_id_info_t *info = NULL; /* Pointer to the ID */
+ int ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -1129,7 +1128,7 @@ int
H5I__inc_type_ref(H5I_type_t type)
{
H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
@@ -1171,7 +1170,7 @@ int
H5I_dec_type_ref(H5I_type_t type)
{
H5I_type_info_t *type_info = NULL; /* Pointer to the ID type */
- herr_t ret_value = 0; /* Return value */
+ herr_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI((-1))
@@ -1215,7 +1214,7 @@ int
H5I__get_type_ref(H5I_type_t type)
{
H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- int ret_value = -1; /* Return value */
+ int ret_value = -1; /* Return value */
FUNC_ENTER_STATIC
@@ -1271,8 +1270,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
H5_GCC_DIAG_ON("cast-qual")
/* Invoke callback function */
- cb_ret_val =
- (*udata->user_func)((void *)object, info->id, udata->user_udata);
+ cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata);
/* Set the return value based on the callback's return value */
if (cb_ret_val > 0)
@@ -1312,8 +1310,8 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
herr_t
H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1357,9 +1355,9 @@ done:
H5I_id_info_t *
H5I__find_id(hid_t id)
{
- H5I_type_t type; /* ID's type */
- H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- H5I_id_info_t *ret_value = NULL; /* Return value */
+ H5I_type_t type; /* ID's type */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ H5I_id_info_t * ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE_NOERR
@@ -1439,8 +1437,8 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
herr_t
H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
{
- H5I_type_info_t *type_info = NULL; /* Pointer to the type */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_info_t *type_info = NULL; /* Pointer to the type */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1472,5 +1470,3 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_find_id() */
-
-