Skip to content

Commit

Permalink
Remove another couple of H5E_clear_stack calls
Browse files Browse the repository at this point in the history
Also clean up links test.

Signed-off-by: Quincey Koziol <[email protected]>
  • Loading branch information
qkoziol committed Oct 17, 2024
1 parent 97420ea commit a67ba27
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 306 deletions.
23 changes: 13 additions & 10 deletions src/H5Dvirtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,25 +890,25 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir

if (src_file) {
H5G_loc_t src_root_loc; /* Object location of source file root group */
bool exists = false;

/* Set up the root group in the destination file */
if (NULL == (src_root_loc.oloc = H5G_oloc(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get object location for root group");
if (NULL == (src_root_loc.path = H5G_nameof(H5G_rootof(src_file))))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get path for root group");

/* Try opening the source dataset */
source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name,
vdset->shared->layout.storage.u.virt.source_dapl);
/* Check if the source dataset exists */
if (H5G_loc_exists(&src_root_loc, source_dset->dset_name, &exists /*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFIND, FAIL, "can't check object's existence");

/* Dataset does not exist */
if (NULL == source_dset->dset) {
/* Reset the error stack */
H5E_clear_stack();
/* Dataset exists */
if (exists) {
/* Try opening the source dataset */
if (NULL == (source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name,
vdset->shared->layout.storage.u.virt.source_dapl)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset");

source_dset->dset_exists = false;
} /* end if */
else {
/* Dataset exists */
source_dset->dset_exists = true;

Expand All @@ -919,6 +919,9 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir
virtual_ent->source_space_status = H5O_VIRTUAL_STATUS_CORRECT;
} /* end if */
} /* end else */
else
/* Dataset does not exist */
source_dset->dset_exists = false;
} /* end if */

done:
Expand Down
5 changes: 1 addition & 4 deletions src/H5Gloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,7 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_

/* Check if the name in this group resolved to a valid object */
if (obj_loc == NULL)
if (lnk)
*exists = false;
else
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no object or link info?");
*exists = false;
else
*exists = true;

Expand Down
13 changes: 9 additions & 4 deletions src/H5Gtraverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
if ((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, false)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group");

/* User-defined callback function */
/* Pause recording errors, if we are just checking for object's existance */

Check failure on line 183 in src/H5Gtraverse.c

View workflow job for this annotation

GitHub Actions / Check for spelling errors

existance ==> existence
if (target & H5G_TARGET_EXISTS)
H5E_pause_stack();

/* Invoke user-defined callback function */
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* (Backwardly compatible with v0 H5L_class_t traversal callback) */
if (link_class->version == H5L_LINK_CLASS_T_VERS_0)
Expand All @@ -194,13 +198,14 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G
H5CX_get_dxpl());
#endif /* H5_NO_DEPRECATED_SYMBOLS */

/* Resume recording errors, if we were just checking for object's existance */

Check failure on line 201 in src/H5Gtraverse.c

View workflow job for this annotation

GitHub Actions / Check for spelling errors

existance ==> existence
if (target & H5G_TARGET_EXISTS)
H5E_resume_stack();

/* Check for failing to locate the object */
if (cb_return < 0) {
/* Check if we just needed to know if the object exists */
if (target & H5G_TARGET_EXISTS) {
/* Clear any errors from the stack */
H5E_clear_stack();

/* Indicate that the object doesn't exist */
*obj_exists = false;

Expand Down
Loading

0 comments on commit a67ba27

Please sign in to comment.