diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5I.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'src/H5I.c')
-rw-r--r-- | src/H5I.c | 763 |
1 files changed, 352 insertions, 411 deletions
@@ -25,83 +25,80 @@ * variables defined in H5Ipublic.h. */ -#include "H5Imodule.h" /* This source code file is part of the H5I module */ -#define H5T_FRIEND /* Suppress error about including H5Tpkg */ - - -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Ipkg.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip Lists */ -#include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* Virtual Object Layer */ - +#include "H5Imodule.h" /* This source code file is part of the H5I module */ +#define H5T_FRIEND /* Suppress error about including H5Tpkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5SLprivate.h" /* Skip Lists */ +#include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Local Macros */ /* Combine a Type number and an atom index into an atom */ -#define H5I_MAKE(g,i) ((((hid_t)(g) & TYPE_MASK) << ID_BITS) | \ - ((hid_t)(i) & ID_MASK)) +#define H5I_MAKE(g, i) ((((hid_t)(g)&TYPE_MASK) << ID_BITS) | ((hid_t)(i)&ID_MASK)) /* Local typedefs */ /* Atom information structure used */ typedef struct H5I_id_info_t { - hid_t id; /* ID for this info */ - unsigned count; /* ref. count for this atom */ - unsigned app_count; /* ref. count of application visible atoms */ - const void *obj_ptr; /* pointer associated with the atom */ + hid_t id; /* ID for this info */ + unsigned count; /* ref. count for this atom */ + unsigned app_count; /* ref. count of application visible atoms */ + const void *obj_ptr; /* pointer associated with the atom */ } H5I_id_info_t; /* ID type structure used */ typedef struct { - const H5I_class_t *cls; /* Pointer to ID class */ - unsigned init_count; /* # of times this type has been initialized*/ - uint64_t id_count; /* Current number of IDs held */ - uint64_t nextid; /* ID to use for the next atom */ - H5I_id_info_t *last_info; /* Info for most recent ID looked up */ - H5SL_t *ids; /* Pointer to skip list that stores IDs */ + const H5I_class_t *cls; /* Pointer to ID class */ + unsigned init_count; /* # of times this type has been initialized*/ + uint64_t id_count; /* Current number of IDs held */ + uint64_t nextid; /* ID to use for the next atom */ + H5I_id_info_t * last_info; /* Info for most recent ID looked up */ + H5SL_t * ids; /* Pointer to skip list that stores IDs */ } H5I_id_type_t; typedef struct { - H5I_search_func_t app_cb; /* Application's callback routine */ - void *app_key; /* Application's "key" (user data) */ - void *ret_obj; /* Object to return */ + H5I_search_func_t app_cb; /* Application's callback routine */ + void * app_key; /* Application's "key" (user data) */ + void * ret_obj; /* Object to return */ } H5I_search_ud_t; typedef struct { - H5I_iterate_func_t op; /* Application's callback routine */ - void *op_data; /* Application's user data */ + H5I_iterate_func_t op; /* Application's callback routine */ + void * op_data; /* Application's user data */ } H5I_iterate_pub_ud_t; /* User data for iterator callback for retrieving an ID corresponding to an object pointer */ typedef struct { - const void *object; /* object pointer to search for */ - H5I_type_t obj_type; /* type of object we are searching for */ - hid_t ret_id; /* ID returned */ + const void *object; /* object pointer to search for */ + H5I_type_t obj_type; /* type of object we are searching for */ + hid_t ret_id; /* ID returned */ } H5I_get_id_ud_t; /* User data for iterator callback for ID iteration */ typedef struct { - H5I_search_func_t user_func; /* 'User' function to invoke */ - void *user_udata; /* User data to pass to 'user' function */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ - H5I_type_t obj_type; /* Type of object we are iterating over */ + H5I_search_func_t user_func; /* 'User' function to invoke */ + void * user_udata; /* User data to pass to 'user' function */ + hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_type_t obj_type; /* Type of object we are iterating over */ } H5I_iterate_ud_t; /* User data for H5I__clear_type_cb */ typedef struct { - H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */ - hbool_t force; /* Whether to always remove the id */ - hbool_t app_ref; /* Whether this is an appl. ref. call */ + H5I_id_type_t *type_ptr; /* Pointer to the type being cleard */ + 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; /* Package initialization variable */ @@ -132,20 +129,19 @@ H5FL_DEFINE_STATIC(H5I_class_t); H5FL_EXTERN(H5VL_object_t); /*--------------------- Local function prototypes ---------------------------*/ -static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); -static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); -static int H5I__destroy_type(H5I_type_t type); -static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); -static void *H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id); -static int H5I__inc_type_ref(H5I_type_t type); -static int H5I__get_type_ref(H5I_type_t type); -static int H5I__search_cb(void *obj, hid_t id, void *_udata); +static void * H5I__unwrap(void *obj_ptr, H5I_type_t type); +static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); +static int H5I__destroy_type(H5I_type_t type); +static void * H5I__remove_verify(hid_t id, H5I_type_t id_type); +static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id); +static int H5I__inc_type_ref(H5I_type_t type); +static int H5I__get_type_ref(H5I_type_t type); +static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); -static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static int H5I__find_id_cb(void *_item, void *_key, void *_udata); -static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); +static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); +static int H5I__find_id_cb(void *_item, void *_key, void *_udata); +static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); - /*------------------------------------------------------------------------- * Function: H5I_term_package * @@ -163,41 +159,40 @@ static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); int H5I_term_package(void) { - int n = 0; + int n = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR - if(H5_PKG_INIT_VAR) { - H5I_id_type_t *type_ptr; /* Pointer to ID type */ - int type; /* Type of ID */ + if (H5_PKG_INIT_VAR) { + H5I_id_type_t *type_ptr; /* Pointer to ID type */ + int type; /* Type of ID */ /* How many types are still being used? */ - for(type = 0; type < H5I_next_type; type++) - if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) + for (type = 0; type < H5I_next_type; type++) + if ((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; /* If no types are used then clean up */ - if(0 == n) { - for(type = 0; type < H5I_next_type; type++) { + if (0 == n) { + for (type = 0; type < H5I_next_type; type++) { type_ptr = H5I_id_type_list_g[type]; - if(type_ptr) { + if (type_ptr) { HDassert(NULL == type_ptr->ids); - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); + type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; n++; } /* end if */ - } /* end for */ + } /* end for */ /* Mark interface closed */ - if(0 == n) + if (0 == n) H5_PKG_INIT_VAR = FALSE; } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(n) } /* end H5I_term_package() */ - /*------------------------------------------------------------------------- * Function: H5Iregister_type * @@ -216,12 +211,11 @@ H5I_term_package(void) *------------------------------------------------------------------------- */ H5I_type_t -H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, - H5I_free_t free_func) +H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED 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 = H5I_BADID; /* Return value */ + H5I_type_t new_type; /* New ID type value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE3("It", "zIux", hash_size, reserved, free_func); @@ -229,41 +223,41 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, /* Generate a new H5I_type_t value */ /* Increment the number of types */ - if(H5I_next_type < H5I_MAX_NUM_TYPES) { + if (H5I_next_type < H5I_MAX_NUM_TYPES) { new_type = (H5I_type_t)H5I_next_type; H5I_next_type++; } /* end if */ else { - hbool_t done; /* Indicate that search was successful */ - int i; /* Local index variable */ + 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]) { + 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; + done = TRUE; } /* end if */ - } /* end for */ + } /* end for */ /* Verify that we found a type to give out */ - if(done == FALSE) + if (done == FALSE) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") } /* end else */ /* Allocate new ID class */ - if(NULL == (cls = H5FL_CALLOC(H5I_class_t))) + if (NULL == (cls = H5FL_CALLOC(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->reserved = reserved; + cls->type_id = new_type; + cls->flags = H5I_CLASS_IS_APPLICATION; + cls->reserved = reserved; cls->free_func = free_func; /* Register the new ID class */ - if(H5I_register_type(cls) < 0) + if (H5I_register_type(cls) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_BADID, "can't initialize ID class") /* Set return value */ @@ -271,14 +265,13 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, done: /* Clean up on error */ - if(ret_value < 0) - if(cls) + if (ret_value < 0) + if (cls) cls = H5FL_FREE(H5I_class_t, cls); FUNC_LEAVE_API(ret_value) } /* end H5Iregister_type() */ - /*------------------------------------------------------------------------- * Function: H5I_register_type * @@ -293,8 +286,8 @@ done: herr_t H5I_register_type(const H5I_class_t *cls) { - H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr = NULL; /* Ptr to the atomic type*/ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -303,9 +296,9 @@ H5I_register_type(const H5I_class_t *cls) HDassert(cls->type_id > 0 && (int)cls->type_id < H5I_MAX_NUM_TYPES); /* Initialize the type */ - if(NULL == H5I_id_type_list_g[cls->type_id]) { + 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 *)H5FL_CALLOC(H5I_id_type_t))) + 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 */ @@ -315,12 +308,12 @@ H5I_register_type(const H5I_class_t *cls) } /* end else */ /* Initialize the ID type structure for new types */ - if(type_ptr->init_count == 0) { - type_ptr->cls = cls; - type_ptr->id_count = 0; - type_ptr->nextid = cls->reserved; + if (type_ptr->init_count == 0) { + type_ptr->cls = cls; + type_ptr->id_count = 0; + type_ptr->nextid = cls->reserved; type_ptr->last_info = NULL; - if(NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) + if (NULL == (type_ptr->ids = H5SL_create(H5SL_TYPE_HID, NULL))) HGOTO_ERROR(H5E_ATOM, H5E_CANTCREATE, FAIL, "skip list creation failed") } /* end if */ @@ -328,18 +321,17 @@ H5I_register_type(const H5I_class_t *cls) type_ptr->init_count++; done: - if(ret_value < 0) { /* Clean up on error */ - if(type_ptr) { - if(type_ptr->ids) + if (ret_value < 0) { /* Clean up on error */ + if (type_ptr) { + if (type_ptr->ids) H5SL_close(type_ptr->ids); (void)H5FL_FREE(H5I_id_type_t, type_ptr); } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register_type() */ - /*------------------------------------------------------------------------- * Function: H5Itype_exists * @@ -353,25 +345,24 @@ done: htri_t H5Itype_exists(H5I_type_t type) { - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "It", type); /* Validate parameter */ - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) ret_value = FALSE; done: FUNC_LEAVE_API(ret_value) } /* end H5Itype_exists() */ - /*------------------------------------------------------------------------- * Function: H5Inmembers * @@ -391,27 +382,27 @@ done: herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members) { - int ret_value = SUCCEED; /* Return value */ + int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "It*h", type, num_members); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == H5I_id_type_list_g[type]) + if (NULL == H5I_id_type_list_g[type]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") - if(num_members) { + if (num_members) { int64_t members; - if((members = H5I_nmembers(type)) < 0) + if ((members = H5I_nmembers(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCOUNT, FAIL, "can't compute number of members") H5_CHECKED_ASSIGN(*num_members, hsize_t, members, int64_t); @@ -421,7 +412,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Inmembers() */ - /*------------------------------------------------------------------------- * Function: H5I_nmembers * @@ -440,15 +430,15 @@ done: int64_t H5I_nmembers(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - int64_t ret_value = 0; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + int64_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Validate parameter */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - if(NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) + if (NULL == (type_ptr = H5I_id_type_list_g[type]) || type_ptr->init_count <= 0) HGOTO_DONE(0); /* Set return value */ @@ -458,7 +448,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_nmembers() */ - /*------------------------------------------------------------------------- * Function: H5I__unwrap * @@ -475,7 +464,7 @@ done: static void * H5I__unwrap(void *obj_ptr, H5I_type_t type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -485,13 +474,13 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { const H5VL_object_t *vol_obj; - vol_obj = (const H5VL_object_t *)obj_ptr; + vol_obj = (const H5VL_object_t *)obj_ptr; ret_value = H5VL_object_data(vol_obj); } /* end if */ - else if(H5I_DATATYPE == type) { + else if (H5I_DATATYPE == type) { H5T_t *dt = (H5T_t *)obj_ptr; ret_value = (void *)H5T_get_actual_type(dt); @@ -502,7 +491,6 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__unwrap() */ - /*------------------------------------------------------------------------- * Function: H5Iclear_type * @@ -521,12 +509,12 @@ H5I__unwrap(void *obj_ptr, H5I_type_t type) herr_t H5Iclear_type(H5I_type_t type, hbool_t force) { - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "Itb", type, force); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_clear_type(type, force, TRUE); @@ -535,7 +523,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iclear_type() */ - /*------------------------------------------------------------------------- * Function: H5I_clear_type * @@ -552,32 +539,31 @@ done: 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 */ - int ret_value = SUCCEED; /* Return value */ + H5I_clear_type_ud_t udata; /* udata struct for callback */ + int ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Validate parameters */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") udata.type_ptr = H5I_id_type_list_g[type]; - if(udata.type_ptr == NULL || udata.type_ptr->init_count <= 0) + if (udata.type_ptr == NULL || udata.type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Finish constructing udata */ - udata.force = force; + udata.force = force; udata.app_ref = app_ref; /* Attempt to free all ids in the type */ - if(H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0) + if (H5SL_try_free_safe(udata.type_ptr->ids, H5I__clear_type_cb, &udata) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't free ids in type") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_clear_type() */ - /*------------------------------------------------------------------------- * Function: H5I__clear_type_cb * @@ -594,9 +580,9 @@ done: static htri_t H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) { - H5I_id_info_t *id = (H5I_id_info_t *)_id; /* Current ID being worked with */ - H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ - htri_t ret_value = FALSE; /* Return value */ + H5I_id_info_t * id = (H5I_id_info_t *)_id; /* Current ID being worked with */ + H5I_clear_type_ud_t *udata = (H5I_clear_type_ud_t *)_udata; /* udata struct */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -608,42 +594,42 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) /* Do nothing to the object if the reference count is larger than * one and forcing is off. */ - if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { + if (udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ - if(udata->force) { + if (udata->type_ptr->cls->free_func && + (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ + if (udata->force) { #ifdef H5I_DEBUG - if(H5DEBUG(I)) { - HDfprintf(H5DEBUG(I), "H5I: free type=%d obj=0x%08lx " - "failure ignored\n", - (int)udata->type_ptr->cls->type_id, - (unsigned long)(id->obj_ptr)); + if (H5DEBUG(I)) { + HDfprintf(H5DEBUG(I), + "H5I: free type=%d obj=0x%08lx " + "failure ignored\n", + (int)udata->type_ptr->cls->type_id, (unsigned long)(id->obj_ptr)); } /* end if */ -#endif /*H5I_DEBUG*/ +#endif /*H5I_DEBUG*/ /* Indicate node should be removed from list */ ret_value = TRUE; } /* end if */ - } /* end if */ + } /* end if */ else { /* Indicate node should be removed from list */ ret_value = TRUE; } /* end else */ /* Remove ID if requested */ - if(ret_value) { + if (ret_value) { /* Free ID info */ id = H5FL_FREE(H5I_id_info_t, id); /* Decrement the number of IDs in the type */ udata->type_ptr->id_count--; } /* end if */ - } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__clear_type_cb() */ - /*------------------------------------------------------------------------- * Function: H5Idestroy_type * @@ -663,12 +649,12 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) herr_t H5Idestroy_type(H5I_type_t type) { - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "It", type); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I__destroy_type(type); @@ -677,7 +663,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Idestroy_type() */ - /*------------------------------------------------------------------------- * Function: H5I__destroy_type * @@ -696,40 +681,38 @@ done: static herr_t H5I__destroy_type(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* ptr to the atomic type */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr; /* ptr to the atomic type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Validate parameter */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Close/clear/destroy all IDs for this type */ - H5E_BEGIN_TRY { - H5I_clear_type(type, TRUE, FALSE); - } H5E_END_TRY /*don't care about errors*/ + H5E_BEGIN_TRY { H5I_clear_type(type, TRUE, FALSE); } + H5E_END_TRY /*don't care about errors*/ - /* 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); + /* 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); - if(H5SL_close(type_ptr->ids) < 0) + if (H5SL_close(type_ptr->ids) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") type_ptr->ids = NULL; - type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); + type_ptr = H5FL_FREE(H5I_id_type_t, type_ptr); H5I_id_type_list_g[type] = NULL; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__destroy_type() */ - /*------------------------------------------------------------------------- * Function: H5Iregister * @@ -743,12 +726,12 @@ done: hid_t H5Iregister(H5I_type_t type, const void *object) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE2("i", "It*x", type, object); - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "cannot call public function on library type") ret_value = H5I_register(type, object, TRUE); @@ -757,7 +740,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iregister() */ - /*------------------------------------------------------------------------- * Function: H5I_register * @@ -777,10 +759,10 @@ done: hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) { - H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ - H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ - hid_t new_id = -1; /* new ID */ - hid_t ret_value = H5I_INVALID_HID; /* return value */ + H5I_id_type_t *type_ptr = NULL; /* ptr to the type */ + H5I_id_info_t *id_ptr = NULL; /* ptr to the new ID information */ + hid_t new_id = -1; /* new ID */ + hid_t ret_value = H5I_INVALID_HID; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -794,11 +776,11 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") /* Create the struct & its ID */ - new_id = H5I_MAKE(type, type_ptr->nextid); - id_ptr->id = new_id; - id_ptr->count = 1; /* initial reference count */ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + new_id = H5I_MAKE(type, type_ptr->nextid); + id_ptr->id = new_id; + id_ptr->count = 1; /* initial reference count */ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -819,7 +801,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register() */ - /*------------------------------------------------------------------------- * Function: H5I_register_using_existing_id * @@ -841,9 +822,9 @@ done: herr_t H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, hid_t existing_id) { - H5I_id_type_t *type_ptr; /* ptr to the type */ - H5I_id_info_t *id_ptr; /* ptr to the new ID information */ - herr_t ret_value = SUCCEED; /* return value */ + H5I_id_type_t *type_ptr; /* ptr to the type */ + H5I_id_info_t *id_ptr; /* ptr to the new ID information */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(FAIL) @@ -851,35 +832,35 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h HDassert(object); /* Make sure ID is not already in use */ - if(NULL != (id_ptr = H5I__find_id(existing_id))) + if (NULL != (id_ptr = H5I__find_id(existing_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "ID already in use") /* Make sure type number is valid */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") /* Get type pointer from list of types */ type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->init_count <= 0) + if (NULL == type_ptr || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") /* Make sure requested ID belongs to object's type */ - if(H5I_TYPE(existing_id) != type) + if (H5I_TYPE(existing_id) != type) HGOTO_ERROR(H5E_ATOM, H5E_BADRANGE, FAIL, "invalid type for provided ID") /* Allocate new structure to house this ID */ - if(NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) + if (NULL == (id_ptr = H5FL_MALLOC(H5I_id_info_t))) HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & insert requested ID */ - id_ptr->id = existing_id; - id_ptr->count = 1; /* initial reference count*/ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = existing_id; + id_ptr->count = 1; /* initial reference count*/ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ - if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) + if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, FAIL, "can't insert ID node into skip list") type_ptr->id_count++; @@ -890,7 +871,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_register_using_existing_id() */ - /*------------------------------------------------------------------------- * Function: H5I_subst * @@ -908,17 +888,17 @@ done: void * H5I_subst(hid_t id, const void *new_object) { - H5I_id_info_t *id_ptr; /* Pointer to the atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_NOTFOUND, NULL, "can't get ID ref count") /* Get the old object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ /* Set the new object pointer for the ID */ id_ptr->obj_ptr = new_object; @@ -927,7 +907,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_subst() */ - /*------------------------------------------------------------------------- * Function: H5I_object * @@ -943,21 +922,20 @@ done: void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ - if(NULL != (id_ptr = H5I__find_id(id))) { + if (NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_object() */ - /*------------------------------------------------------------------------- * Function: H5Iobject_verify * @@ -974,15 +952,15 @@ H5I_object(hid_t id) void * H5Iobject_verify(hid_t id, H5I_type_t id_type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); /* Validate parameters */ - if(H5I_IS_LIB_TYPE(id_type)) + if (H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") - if(id_type < 1 || (int)id_type >= H5I_next_type) + if (id_type < 1 || (int)id_type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "identifier has invalid type") ret_value = H5I_object_verify(id, id_type); @@ -991,7 +969,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iobject_verify() */ - /*------------------------------------------------------------------------- * Function: H5I_object_verify * @@ -1010,23 +987,22 @@ done: void * H5I_object_verify(hid_t id, H5I_type_t id_type) { - H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR HDassert(id_type >= 1 && (int)id_type < H5I_next_type); /* Verify that the type of the ID is correct & lookup the ID */ - if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { + if (id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ } FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ - /*------------------------------------------------------------------------- * Function: H5I_get_type * @@ -1048,11 +1024,11 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) H5I_type_t H5I_get_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_NOAPI_NOERR - if(id > 0) + if (id > 0) ret_value = H5I_TYPE(id); HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type); @@ -1060,7 +1036,6 @@ H5I_get_type(hid_t id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ - /*------------------------------------------------------------------------- * Function: H5Iget_type * @@ -1079,21 +1054,20 @@ H5I_get_type(hid_t id) H5I_type_t H5Iget_type(hid_t id) { - H5I_type_t ret_value = H5I_BADID; /* Return value */ + H5I_type_t ret_value = H5I_BADID; /* Return value */ FUNC_ENTER_API(H5I_BADID) H5TRACE1("It", "i", id); ret_value = H5I_get_type(id); - if(ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) + if (ret_value <= H5I_BADID || (int)ret_value >= H5I_next_type || NULL == H5I_object(id)) HGOTO_DONE(H5I_BADID); done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_type() */ - /*------------------------------------------------------------------------- * Function: H5I_is_file_object * @@ -1112,8 +1086,8 @@ done: htri_t H5I_is_file_object(hid_t id) { - H5I_type_t id_type = H5I_get_type(id); - htri_t ret_value = FAIL; + H5I_type_t id_type = H5I_get_type(id); + htri_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL); @@ -1130,7 +1104,7 @@ H5I_is_file_object(hid_t id) H5T_t *dt = NULL; - if(NULL == (dt = (H5T_t *)H5I_object(id))) + if (NULL == (dt = (H5T_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct"); ret_value = H5T_is_named(dt); @@ -1142,7 +1116,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5I_is_file_object() */ - /*------------------------------------------------------------------------- * Function: H5Iremove_verify * @@ -1163,12 +1136,12 @@ done: void * H5Iremove_verify(hid_t id, H5I_type_t id_type) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE2("*x", "iIt", id, id_type); - if(H5I_IS_LIB_TYPE(id_type)) + if (H5I_IS_LIB_TYPE(id_type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Remove the id */ @@ -1178,7 +1151,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iremove_verify() */ - /*------------------------------------------------------------------------- * Function: H5I__remove_verify * @@ -1198,20 +1170,19 @@ done: static void * H5I__remove_verify(hid_t id, H5I_type_t id_type) { - void * ret_value = NULL; /*return value */ + void *ret_value = NULL; /*return value */ FUNC_ENTER_STATIC_NOERR /* Argument checking will be performed by H5I_remove() */ /* Verify that the type of the ID is correct */ - if(id_type == H5I_TYPE(id)) + if (id_type == H5I_TYPE(id)) ret_value = H5I_remove(id); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__remove_verify() */ - /*------------------------------------------------------------------------- * Function: H5I__remove_common * @@ -1230,8 +1201,8 @@ H5I__remove_verify(hid_t id, H5I_type_t id_type) static void * H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) { - H5I_id_info_t *curr_id; /* Pointer to the current atom */ - void *ret_value = NULL; /* Return value */ + H5I_id_info_t *curr_id; /* Pointer to the current atom */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -1239,15 +1210,15 @@ H5I__remove_common(H5I_id_type_t *type_ptr, hid_t id) HDassert(type_ptr); /* Get the ID node for the ID */ - if(NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) + if (NULL == (curr_id = (H5I_id_info_t *)H5SL_remove(type_ptr->ids, &id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node from skip list") /* Check if this ID was the last one accessed */ - if(type_ptr->last_info == curr_id) + if (type_ptr->last_info == curr_id) type_ptr->last_info = NULL; - ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ - curr_id = H5FL_FREE(H5I_id_info_t, curr_id); + ret_value = (void *)curr_id->obj_ptr; /* (Casting away const OK -QAK) */ + curr_id = H5FL_FREE(H5I_id_info_t, curr_id); /* Decrement the number of IDs in the type */ (type_ptr->id_count)--; @@ -1256,7 +1227,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__remove_common() */ - /*------------------------------------------------------------------------- * Function: H5I_remove * @@ -1274,29 +1244,28 @@ done: void * H5I_remove(hid_t id) { - H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ - H5I_type_t type; /* Atom's atomic type */ - void * ret_value = NULL; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the atomic type */ + H5I_type_t type; /* Atom's atomic type */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid type") /* Remove the node from the type */ - if(NULL == (ret_value = H5I__remove_common(type_ptr, id))) + if (NULL == (ret_value = H5I__remove_common(type_ptr, id))) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, NULL, "can't remove ID node") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_remove() */ - /*------------------------------------------------------------------------- * Function: H5Idec_ref * @@ -1315,24 +1284,23 @@ done: int H5Idec_ref(hid_t id) { - int ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); /* Check arguments */ - if(id < 0) + if (id < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID") /* Do actual decrement operation */ - if((ret_value = H5I_dec_app_ref(id)) < 0) + if ((ret_value = H5I_dec_app_ref(id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_ref * @@ -1351,8 +1319,8 @@ done: int H5I_dec_ref(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1360,7 +1328,7 @@ H5I_dec_ref(hid_t id) HDassert(id >= 0); /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* If this is the last reference to the object then invoke the type's @@ -1377,16 +1345,16 @@ H5I_dec_ref(hid_t id) * write when a dataset is closed and the chunk cache is flushed to the * file. We have to close the dataset anyway. (SLU - 2010/9/7) */ - if(1 == id_ptr->count) { - H5I_id_type_t *type_ptr; /*ptr to the type */ + if (1 == id_ptr->count) { + H5I_id_type_t *type_ptr; /*ptr to the type */ /* Get the ID's type */ type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; /* (Casting away const OK -QAK) */ - if(!type_ptr->cls->free_func || (type_ptr->cls->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) { /* Remove the node from the type */ - if(NULL == H5I__remove_common(type_ptr, id)) + if (NULL == H5I__remove_common(type_ptr, id)) HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, (-1), "can't remove ID node") ret_value = 0; } /* end if */ @@ -1402,7 +1370,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_app_ref * @@ -1420,8 +1387,8 @@ done: int H5I_dec_app_ref(hid_t id) { - H5I_id_info_t *id_ptr; /* Pointer to the new ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1429,13 +1396,13 @@ H5I_dec_app_ref(hid_t id) HDassert(id >= 0); /* Call regular decrement reference count routine */ - if((ret_value = H5I_dec_ref(id)) < 0) + if ((ret_value = H5I_dec_ref(id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTDEC, (-1), "can't decrement ID ref count") /* Check if the ID still exists */ - if(ret_value > 0) { + if (ret_value > 0) { /* General lookup of the ID */ - if(NULL == (id_ptr = H5I__find_id(id))) + if (NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "can't locate ID") /* Adjust app_ref */ @@ -1450,7 +1417,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_app_ref_always_close * @@ -1465,7 +1431,7 @@ done: int H5I_dec_app_ref_always_close(hid_t id) { - int ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1492,7 +1458,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_app_ref_always_close() */ - /*------------------------------------------------------------------------- * Function: H5Iinc_ref * @@ -1506,7 +1471,7 @@ done: int H5Iinc_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); @@ -1523,7 +1488,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_inc_ref * @@ -1537,8 +1501,8 @@ done: int H5I_inc_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1561,7 +1525,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_inc_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iget_ref * @@ -1575,7 +1538,7 @@ done: int H5Iget_ref(hid_t id) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "i", id); @@ -1592,7 +1555,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_get_ref * @@ -1606,8 +1568,8 @@ done: int H5I_get_ref(hid_t id, hbool_t app_ref) { - H5I_id_info_t *id_ptr; /* Pointer to the ID */ - int ret_value = 0; /* Return value */ + H5I_id_info_t *id_ptr; /* Pointer to the ID */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) @@ -1625,7 +1587,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iinc_type_ref * @@ -1639,26 +1600,25 @@ done: int H5Iinc_type_ref(H5I_type_t type) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || (int)type >= H5I_next_type) + if (type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual increment operation */ - if((ret_value = H5I__inc_type_ref(type)) < 0) + if ((ret_value = H5I__inc_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, (-1), "can't increment ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iinc_ref() */ - /*------------------------------------------------------------------------- * Function: H5I__inc_type_ref * @@ -1672,8 +1632,8 @@ done: static int H5I__inc_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1682,7 +1642,7 @@ H5I__inc_type_ref(H5I_type_t type) /* Check arguments */ type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr) + if (NULL == type_ptr) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Set return value */ @@ -1692,7 +1652,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__inc_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Idec_type_ref * @@ -1720,7 +1679,7 @@ done: herr_t H5Idec_type_ref(H5I_type_t type) { - herr_t ret_value = 0; /* Return value */ + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("e", "It", type); @@ -1734,7 +1693,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Idec_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5I_dec_type_ref * @@ -1757,16 +1715,16 @@ done: int H5I_dec_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the ID type */ - herr_t ret_value = 0; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the ID type */ + herr_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI((-1)) - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") type_ptr = H5I_id_type_list_g[type]; - if(type_ptr == NULL || type_ptr->init_count <= 0) + if (type_ptr == NULL || type_ptr->init_count <= 0) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "invalid type") /* Decrement the number of users of the atomic type. If this is the @@ -1774,7 +1732,7 @@ H5I_dec_type_ref(H5I_type_t type) * free all memory it used. The free function is invoked for each atom * being freed. */ - if(1 == type_ptr->init_count) { + if (1 == type_ptr->init_count) { H5I__destroy_type(type); ret_value = 0; } /* end if */ @@ -1787,7 +1745,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_dec_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iget_type_ref * @@ -1801,26 +1758,25 @@ done: int H5Iget_type_ref(H5I_type_t type) { - int ret_value; /* Return value */ + int ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE1("Is", "It", type); /* Check arguments */ - if(type <= 0 || (int)type >= H5I_next_type) + if (type <= 0 || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, (-1), "invalid ID type") - if(H5I_IS_LIB_TYPE(type)) + if (H5I_IS_LIB_TYPE(type)) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, (-1), "cannot call public function on library type") /* Do actual retrieve operation */ - if((ret_value = H5I__get_type_ref(type)) < 0) + if ((ret_value = H5I__get_type_ref(type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get ID type ref count") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_ref() */ - /*------------------------------------------------------------------------- * Function: H5I__get_type_ref * @@ -1835,8 +1791,8 @@ done: static int H5I__get_type_ref(H5I_type_t type) { - H5I_id_type_t *type_ptr; /* Pointer to the type */ - int ret_value = -1; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + int ret_value = -1; /* Return value */ FUNC_ENTER_STATIC @@ -1855,7 +1811,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__get_type_ref() */ - /*------------------------------------------------------------------------- * Function: H5Iis_valid * @@ -1869,8 +1824,8 @@ done: htri_t H5Iis_valid(hid_t id) { - H5I_id_info_t *id_ptr; /* ptr to the ID */ - htri_t ret_value = TRUE; /* Return value */ + H5I_id_info_t *id_ptr; /* ptr to the ID */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "i", id); @@ -1885,7 +1840,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iis_valid() */ - /*------------------------------------------------------------------------- * Function: H5I__search_cb * @@ -1901,26 +1855,25 @@ done: static int H5I__search_cb(void *obj, hid_t id, void *_udata) { - H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ - herr_t cb_ret_val; /* User callback return value */ - int ret_value = H5_ITER_ERROR; /* Callback return value */ + H5I_search_ud_t *udata = (H5I_search_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ FUNC_ENTER_STATIC_NOERR cb_ret_val = (*udata->app_cb)(obj, id, udata->app_key); /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) { - ret_value = H5_ITER_STOP; /* terminate iteration early */ - udata->ret_obj = obj; /* also set out parameter */ + if (cb_ret_val > 0) { + ret_value = H5_ITER_STOP; /* terminate iteration early */ + udata->ret_obj = obj; /* also set out parameter */ } - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__search_cb() */ - /*------------------------------------------------------------------------- * Function: H5Isearch * @@ -1944,8 +1897,8 @@ H5I__search_cb(void *obj, hid_t id, void *_udata) void * H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) { - H5I_search_ud_t udata; /* Context for iteration */ - void *ret_value; /* Return value */ + H5I_search_ud_t udata; /* Context for iteration */ + void * ret_value; /* Return value */ FUNC_ENTER_API(NULL) H5TRACE3("*x", "Itx*x", type, func, key); @@ -1955,7 +1908,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "cannot call public function on library type") /* Set up udata struct */ - udata.app_cb = func; + udata.app_cb = func; udata.app_key = key; udata.ret_obj = NULL; @@ -1971,7 +1924,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Isearch() */ - /*------------------------------------------------------------------------- * Function: H5I__iterate_pub_cb * @@ -1991,9 +1943,9 @@ done: static int H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) { - H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ - herr_t cb_ret_val; /* User callback return value */ - int ret_value = H5_ITER_ERROR; /* Callback return value */ + H5I_iterate_pub_ud_t *udata = (H5I_iterate_pub_ud_t *)_udata; /* User data for callback */ + herr_t cb_ret_val; /* User callback return value */ + int ret_value = H5_ITER_ERROR; /* Callback return value */ FUNC_ENTER_STATIC_NOERR @@ -2001,17 +1953,16 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) cb_ret_val = (*udata->op)(id, udata->op_data); /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + if (cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ else ret_value = H5_ITER_CONT; /* continue iteration */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_pub_cb() */ - /*------------------------------------------------------------------------- * Function: H5Iiterate * @@ -2038,15 +1989,15 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) { - H5I_iterate_pub_ud_t int_udata; /* Internal user data */ - herr_t ret_value; /* Return value */ + H5I_iterate_pub_ud_t int_udata; /* Internal user data */ + herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "Itx*x", type, op, op_data); /* Set up udata struct */ - int_udata.op = op; - int_udata.op_data = op_data; + int_udata.op = op; + int_udata.op_data = op_data; /* Note that H5I_iterate returns an error code. We ignore it * here, as we can't do anything with it without revising the API. @@ -2058,7 +2009,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iiterate() */ - /*------------------------------------------------------------------------- * Function: H5I__iterate_cb * @@ -2074,19 +2024,19 @@ done: static int H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ - int ret_value = H5_ITER_CONT; /* Callback return value */ + H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_iterate_ud_t *udata = (H5I_iterate_ud_t *)_udata; /* User data for callback */ + int ret_value = H5_ITER_CONT; /* Callback return value */ FUNC_ENTER_STATIC_NOERR /* Only invoke the callback function if this ID is visible externally and * its reference count is positive. */ - if((!udata->app_ref) || (item->app_count > 0)) { - H5I_type_t type = udata->obj_type; - void *obj_ptr; - herr_t cb_ret_val; + if ((!udata->app_ref) || (item->app_count > 0)) { + H5I_type_t type = udata->obj_type; + void * obj_ptr; + herr_t cb_ret_val; /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). @@ -2094,19 +2044,19 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) obj_ptr = H5I__unwrap((void *)item->obj_ptr, type); /* Invoke callback function */ - cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ + cb_ret_val = + (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ /* Set the return value based on the callback's return value */ - if(cb_ret_val > 0) - ret_value = H5_ITER_STOP; /* terminate iteration early */ - else if(cb_ret_val < 0) - ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ - } /* end if */ + if (cb_ret_val > 0) + ret_value = H5_ITER_STOP; /* terminate iteration early */ + else if (cb_ret_val < 0) + ret_value = H5_ITER_ERROR; /* indicate failure (which terminates iteration) */ + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__iterate_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_iterate * @@ -2136,28 +2086,28 @@ herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { H5I_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") type_ptr = H5I_id_type_list_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ - if(type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ - herr_t iter_status; /* Iteration status */ + if (type_ptr && type_ptr->init_count > 0 && type_ptr->id_count > 0) { + H5I_iterate_ud_t iter_udata; /* User data for iteration callback */ + herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - iter_udata.user_func = func; - iter_udata.user_udata = udata; - iter_udata.app_ref = app_ref; - iter_udata.obj_type = type; + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; + iter_udata.obj_type = type; /* Iterate over IDs */ - if((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) + if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") } /* end if */ @@ -2165,7 +2115,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_iterate() */ - /*------------------------------------------------------------------------- * Function: H5I__find_id * @@ -2181,22 +2130,22 @@ done: static H5I_id_info_t * H5I__find_id(hid_t id) { - H5I_type_t type; /*ID's type */ - H5I_id_type_t *type_ptr; /*ptr to the type */ - H5I_id_info_t *ret_value = NULL; /* Return value */ + H5I_type_t type; /*ID's type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ + H5I_id_info_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Check arguments */ type = H5I_TYPE(id); - if(type <= H5I_BADID || (int)type >= H5I_next_type) + if (type <= H5I_BADID || (int)type >= H5I_next_type) HGOTO_DONE(NULL) type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) + if (!type_ptr || type_ptr->init_count <= 0) HGOTO_DONE(NULL) /* Check for same ID as we have looked up last time */ - if(type_ptr->last_info && type_ptr->last_info->id == id) + if (type_ptr->last_info && type_ptr->last_info->id == id) ret_value = type_ptr->last_info; else { /* Locate the ID node for the ID */ @@ -2210,7 +2159,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id() */ - /*------------------------------------------------------------------------- * Function: H5Iget_name * @@ -2236,32 +2184,32 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5Iget_name(hid_t id, char *name/*out*/, size_t size) +H5Iget_name(hid_t id, char *name /*out*/, size_t size) { - H5VL_object_t *vol_obj; /* Object of loc_id */ + H5VL_object_t * vol_obj; /* Object of loc_id */ H5VL_loc_params_t loc_params; - ssize_t ret_value; /* Return value */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get the object pointer */ - if(NULL == (vol_obj = H5VL_vol_object(id))) + if (NULL == (vol_obj = H5VL_vol_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") /* Set location parameters */ - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = H5I_get_type(id); + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(id); /* Retrieve object's name */ - if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size) < 0) + if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + &ret_value, name, size) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ - /*------------------------------------------------------------------------- * Function: H5Iget_file_id * @@ -2277,8 +2225,8 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - H5I_type_t type; /* ID type */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5I_type_t type; /* ID type */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); @@ -2287,15 +2235,16 @@ H5Iget_file_id(hid_t obj_id) type = H5I_TYPE(obj_id); /* Call internal function */ - if(H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - H5VL_object_t *vol_obj; /* Object of obj_id */ + if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || + H5I_ATTR == type) { + H5VL_object_t *vol_obj; /* Object of obj_id */ /* Get the VOL object */ - if(NULL == (vol_obj = H5VL_vol_object(obj_id))) + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Get the file ID */ - if((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) + if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else @@ -2305,7 +2254,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Iget_file_id() */ - /*------------------------------------------------------------------------- * Function: H5I__find_id_cb * @@ -2319,11 +2267,11 @@ done: static int H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ - H5I_type_t type = udata->obj_type; - const void *obj_ptr = NULL; - int ret_value = H5_ITER_CONT; /* Return value */ + H5I_id_info_t * item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_get_id_ud_t *udata = (H5I_get_id_ud_t *)_udata; /* Pointer to user data */ + H5I_type_t type = udata->obj_type; + const void * obj_ptr = NULL; + int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -2337,13 +2285,12 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Check for a match */ if (obj_ptr == udata->object) { udata->ret_id = item->id; - ret_value = H5_ITER_STOP; + ret_value = H5_ITER_STOP; } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_find_id * @@ -2358,8 +2305,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_id_type_t *type_ptr; /* Pointer to the type */ - herr_t ret_value = SUCCEED; /* Return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2373,13 +2320,13 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) /* Only iterate through ID list if it is initialized and there are IDs in type */ if (type_ptr->init_count > 0 && type_ptr->id_count > 0) { - H5I_get_id_ud_t udata; /* User data */ - herr_t iter_status; /* Iteration status */ + H5I_get_id_ud_t udata; /* User data */ + herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - udata.object = object; - udata.obj_type = type; - udata.ret_id = H5I_INVALID_HID; + udata.object = object; + udata.obj_type = type; + udata.ret_id = H5I_INVALID_HID; /* Iterate over IDs for the ID type */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__find_id_cb, &udata)) < 0) @@ -2392,7 +2339,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_find_id() */ - /*------------------------------------------------------------------------- * Function: H5I__id_dump_cb * @@ -2405,10 +2351,10 @@ done: static int H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { - H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ - H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ - H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL connector object */ + H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ + H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ + H5G_name_t * path = NULL; /* Path to file object */ + const void * obj_ptr = NULL; /* Pointer to VOL connector object */ FUNC_ENTER_STATIC_NOERR @@ -2418,32 +2364,29 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* Get the group location, so we get get the name */ switch (type) { - case H5I_GROUP: - { + case H5I_GROUP: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5G_nameof((const H5G_t *)obj_ptr); break; } - case H5I_DATASET: - { + case H5I_DATASET: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->connector->cls->value) + if (H5_VOL_NATIVE == vol_obj->connector->cls->value) path = H5D_nameof((const H5D_t *)obj_ptr); break; } - case H5I_DATATYPE: - { + case H5I_DATATYPE: { const H5T_t *dt = (const H5T_t *)item->obj_ptr; obj_ptr = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */ - path = H5T_nameof((const H5T_t *)obj_ptr); + path = H5T_nameof((const H5T_t *)obj_ptr); break; } @@ -2467,7 +2410,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - break; /* Other types of IDs are not stored in files */ + break; /* Other types of IDs are not stored in files */ } if (path) { @@ -2480,7 +2423,6 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_LEAVE_NOAPI(H5_ITER_CONT) } /* end H5I__id_dump_cb() */ - /*------------------------------------------------------------------------- * Function: H5I_dump_ids_for_type * @@ -2493,14 +2435,14 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) herr_t H5I_dump_ids_for_type(H5I_type_t type) { - H5I_id_type_t *type_ptr = NULL; + H5I_id_type_t *type_ptr = NULL; FUNC_ENTER_NOAPI_NOERR HDfprintf(stderr, "Dumping ID type %d\n", (int)type); type_ptr = H5I_id_type_list_g[type]; - if(type_ptr) { + if (type_ptr) { /* Header */ HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count); @@ -2509,7 +2451,7 @@ H5I_dump_ids_for_type(H5I_type_t type) HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid); /* List */ - if(type_ptr->id_count > 0) { + if (type_ptr->id_count > 0) { HDfprintf(stderr, " List:\n"); H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type); } @@ -2519,4 +2461,3 @@ H5I_dump_ids_for_type(H5I_type_t type) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I_dump_ids_for_type() */ - |