summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-19 03:51:19 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-19 03:51:19 (GMT)
commitd812c6fe60fec2451d8d78b8fb51547628307a6c (patch)
treefb1f02516e6dfe5abce1cdb0155046b5d68a73d5 /tools/src
parentc31460c1b76c8d11534b57f025c57bdff9321f44 (diff)
downloadhdf5-d812c6fe60fec2451d8d78b8fb51547628307a6c.zip
hdf5-d812c6fe60fec2451d8d78b8fb51547628307a6c.tar.gz
hdf5-d812c6fe60fec2451d8d78b8fb51547628307a6c.tar.bz2
Cleanup API context function usage.
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/misc/h5debug.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
index 7e00b4f..b66e7ce 100644
--- a/tools/src/misc/h5debug.c
+++ b/tools/src/misc/h5debug.c
@@ -255,7 +255,7 @@ main(int argc, char *argv[])
size_t u;
H5E_auto2_t func;
void *edata;
-hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t status = SUCCEED;
if(argc == 1) {
@@ -289,11 +289,14 @@ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
HDfprintf(stderr, "cannot open file\n");
HDexit(1);
} /* end if */
-if(H5CX_push() < 0) {
- HDfprintf(stderr, "cannot set API context\n");
- HDexit(1);
-}
-api_ctx_pushed = TRUE;
+
+ /* Push API context */
+ if(H5CX_push() < 0) {
+ HDfprintf(stderr, "cannot set API context\n");
+ HDexit(1);
+ }
+ api_ctx_pushed = TRUE;
+
if(NULL == (f = (H5F_t *)H5I_object(fid))) {
HDfprintf(stderr, "cannot obtain H5F_t pointer\n");
HDexit(2);
@@ -719,7 +722,9 @@ api_ctx_pushed = TRUE;
H5Pclose(fapl);
H5Fclose(fid);
-if(api_ctx_pushed) H5CX_pop();
+
+ /* Pop API context */
+ if(api_ctx_pushed) H5CX_pop();
H5Eset_auto2(H5E_DEFAULT, func, edata);