summaryrefslogtreecommitdiffstats
path: root/test/flush2.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-09-14 03:58:59 (GMT)
commit102337449220dfc29be1cce29147704b9c760832 (patch)
tree2f57d117f2bd934eac2768be18dcc866619f390f /test/flush2.c
parentf16361d5f1dc70c344d8143270aa4aeaa867f244 (diff)
downloadhdf5-102337449220dfc29be1cce29147704b9c760832.zip
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.gz
hdf5-102337449220dfc29be1cce29147704b9c760832.tar.bz2
[svn-r27768] Description:
Complete revamp of package initialization/shutdown mechanism in the library. Each package now has a single init/term routine. This new way should avoid packages being re-initialized during library shutdown and is also be _much_ more proactive about giving feedback for resource leaks internal to the library. Introduces a new "module" header file for packages in the library (e.g src/H5Fmodule.h) which sets up some necessary package configuration macros for the FUNC_ENTER/LEAVE macros. (The VFL drivers have their own slightly modified version of this header, src/H5FDdrvr_module.h) Also cleaned up a bunch of resources leaks all across the library and tests, along with addressing many warnings, as I encountered them. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel Linux/64 3.10.x (kituo) w/serial & parallel Linux/64 2.6.x (ostrich) w/serial
Diffstat (limited to 'test/flush2.c')
-rw-r--r--test/flush2.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/test/flush2.c b/test/flush2.c
index 0ee299e..e86d646 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -107,7 +107,7 @@ error:
static int
check_file(char* filename, hid_t fapl, int flag)
{
- hid_t file, groups, grp;
+ hid_t file = -1, groups = -1;
char name[1024];
int i;
@@ -117,6 +117,7 @@ check_file(char* filename, hid_t fapl, int flag)
/* Open some groups */
if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error;
for(i = 0; i < 100; i++) {
+ hid_t grp;
sprintf(name, "grp%02u", (unsigned)i);
if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error;
if(H5Gclose(grp) < 0) goto error;
@@ -132,6 +133,11 @@ check_file(char* filename, hid_t fapl, int flag)
return 0;
error:
+ H5E_BEGIN_TRY {
+ H5Gclose(groups);
+ H5Fclose(file);
+ } H5E_END_TRY;
+
return 1;
} /* end check_file() */
@@ -184,14 +190,13 @@ main(void)
h5_fixname(FILENAME[1], fapl, name, sizeof name);
if(check_file(name, fapl, FALSE))
PASSED()
- else
- {
+ else {
#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
- SKIPPED();
- puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
+ SKIPPED();
+ puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
#else
- H5_FAILED()
- goto error;
+ H5_FAILED()
+ goto error;
#endif
}
H5Eset_auto2(H5E_DEFAULT, func, NULL);
@@ -205,17 +210,16 @@ main(void)
h5_fixname(FILENAME[2], fapl, name, sizeof name);
if(check_file(name, fapl, TRUE))
PASSED()
- else
- {
+ else {
#if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS)
- SKIPPED();
- puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
+ SKIPPED();
+ puts(" DLL will flush the file even when calling _exit, skip this test temporarily");
#else
- H5_FAILED()
- goto error;
+ H5_FAILED()
+ goto error;
#endif
-
}
+
H5Eset_auto2(H5E_DEFAULT, func, NULL);
h5_cleanup(FILENAME, fapl);