summaryrefslogtreecommitdiffstats
path: root/src/H5Iint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Iint.c')
-rw-r--r--src/H5Iint.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/src/H5Iint.c b/src/H5Iint.c
index 7d8b4ac..1c53214 100644
--- a/src/H5Iint.c
+++ b/src/H5Iint.c
@@ -369,17 +369,16 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
*/
if (udata->force || (info->count - (!udata->app_ref * info->app_count)) <= 1) {
/* Check if this is an un-realized future object */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (info->is_future) {
/* Discard the future object */
- if ((info->discard_cb)((void *)info->object) < 0) {
+ if ((info->discard_cb)(info->u.object) < 0) {
if (udata->force) {
#ifdef H5I_DEBUG
if (H5DEBUG(I)) {
fprintf(H5DEBUG(I),
"H5I: discard type=%d obj=%p "
"failure ignored\n",
- (int)udata->type_info->cls->type, info->object);
+ (int)udata->type_info->cls->type, info->u.c_object);
}
#endif /* H5I_DEBUG */
@@ -395,14 +394,14 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
else {
/* Check for a 'free' function and call it, if it exists */
if (udata->type_info->cls->free_func &&
- (udata->type_info->cls->free_func)((void *)info->object, H5_REQUEST_NULL) < 0) {
+ (udata->type_info->cls->free_func)(info->u.object, H5_REQUEST_NULL) < 0) {
if (udata->force) {
#ifdef H5I_DEBUG
if (H5DEBUG(I)) {
fprintf(H5DEBUG(I),
"H5I: free type=%d obj=%p "
"failure ignored\n",
- (int)udata->type_info->cls->type, info->object);
+ (int)udata->type_info->cls->type, info->u.c_object);
}
#endif /* H5I_DEBUG */
@@ -415,7 +414,6 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
mark = true;
}
}
- H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Remove ID if requested */
if (mark) {
@@ -524,7 +522,7 @@ H5I__register(H5I_type_t type, const void *object, bool app_ref, H5I_future_real
info->id = new_id;
info->count = 1; /* initial reference count */
info->app_count = !!app_ref;
- info->object = object;
+ info->u.c_object = object;
info->is_future = (NULL != realize_cb);
info->realize_cb = realize_cb;
info->discard_cb = discard_cb;
@@ -633,7 +631,7 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, bool app_ref, hid_
info->id = existing_id;
info->count = 1; /* initial reference count*/
info->app_count = !!app_ref;
- info->object = object;
+ info->u.object = object;
/* This API call is only used by the native VOL connector, which is
* not asynchronous.
*/
@@ -677,12 +675,10 @@ H5I_subst(hid_t id, const void *new_object)
HGOTO_ERROR(H5E_ID, H5E_NOTFOUND, NULL, "can't get ID ref count");
/* Get the old object pointer to return */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- ret_value = (void *)info->object;
- H5_GCC_CLANG_DIAG_ON("cast-qual")
+ ret_value = info->u.object;
/* Set the new object pointer for the ID */
- info->object = new_object;
+ info->u.c_object = new_object;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -709,12 +705,9 @@ H5I_object(hid_t id)
FUNC_ENTER_NOAPI_NOERR
/* General lookup of the ID */
- if (NULL != (info = H5I__find_id(id))) {
+ if (NULL != (info = H5I__find_id(id)))
/* Get the object pointer to return */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- ret_value = (void *)info->object;
- H5_GCC_CLANG_DIAG_ON("cast-qual")
- }
+ ret_value = info->u.object;
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_object() */
@@ -742,12 +735,9 @@ H5I_object_verify(hid_t id, H5I_type_t type)
assert(type >= 1 && (int)type < H5I_next_type_g);
/* Verify that the type of the ID is correct & lookup the ID */
- if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) {
+ if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id)))
/* Get the object pointer to return */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- ret_value = (void *)info->object;
- H5_GCC_CLANG_DIAG_ON("cast-qual")
- }
+ ret_value = info->u.object;
FUNC_LEAVE_NOAPI(ret_value)
} /* H5I_object_verify() */
@@ -898,9 +888,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
if (type_info->last_id_info == info)
type_info->last_id_info = NULL;
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- ret_value = (void *)info->object;
- H5_GCC_CLANG_DIAG_ON("cast-qual")
+ ret_value = info->u.object;
if (!H5I_marking_s)
info = H5FL_FREE(H5I_id_info_t, info);
@@ -1000,8 +988,7 @@ H5I__dec_ref(hid_t id, void **request)
/* Get the ID's type */
type_info = H5I_type_info_array_g[H5I_TYPE(id)];
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) {
+ if (!type_info->cls->free_func || (type_info->cls->free_func)(info->u.object, request) >= 0) {
/* Remove the node from the type */
if (NULL == H5I__remove_common(type_info, id))
HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, (-1), "can't remove ID node");
@@ -1009,7 +996,6 @@ H5I__dec_ref(hid_t id, void **request)
} /* end if */
else
ret_value = -1;
- H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
else {
--(info->count);
@@ -1482,9 +1468,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
/* 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.).
*/
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- object = H5I__unwrap((void *)info->object, type);
- H5_GCC_CLANG_DIAG_ON("cast-qual")
+ object = H5I__unwrap(info->u.object, type);
/* Invoke callback function */
cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata);
@@ -1607,14 +1591,13 @@ H5I__find_id(hid_t id)
}
/* Check if this is a future ID */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (id_info && id_info->is_future) {
hid_t actual_id = H5I_INVALID_HID; /* ID for actual object */
void *future_object; /* Pointer to the future object */
void *actual_object; /* Pointer to the actual object */
/* Invoke the realize callback, to get the actual object */
- if ((id_info->realize_cb)((void *)id_info->object, &actual_id) < 0)
+ if ((id_info->realize_cb)(id_info->u.object, &actual_id) < 0)
HGOTO_DONE(NULL);
/* Verify that we received a valid ID, of the same type */
@@ -1624,10 +1607,10 @@ H5I__find_id(hid_t id)
HGOTO_DONE(NULL);
/* Swap the actual object in for the future object */
- future_object = (void *)id_info->object;
+ future_object = id_info->u.object;
actual_object = H5I__remove_common(type_info, actual_id);
assert(actual_object);
- id_info->object = actual_object;
+ id_info->u.object = actual_object;
/* Discard the future object */
if ((id_info->discard_cb)(future_object) < 0)
@@ -1639,7 +1622,6 @@ H5I__find_id(hid_t id)
id_info->realize_cb = NULL;
id_info->discard_cb = NULL;
}
- H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Set return value */
ret_value = id_info;
@@ -1674,9 +1656,7 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
assert(udata);
/* Get a pointer to the VOL connector's data */
- H5_GCC_CLANG_DIAG_OFF("cast-qual")
- object = H5I__unwrap((void *)info->object, type);
- H5_GCC_CLANG_DIAG_ON("cast-qual")
+ object = H5I__unwrap(info->u.object, type);
/* Check for a match */
if (object == udata->object) {