summaryrefslogtreecommitdiffstats
path: root/testpar/t_pflush2.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-01 20:54:41 (GMT)
committerGitHub <noreply@github.com>2022-05-01 20:54:41 (GMT)
commit2ba7a01bfff451b043e2ec00811c0aad78921545 (patch)
tree31dc785e35a95578ea9fbb491fbc931e62234302 /testpar/t_pflush2.c
parent5eba258d90aa89c3d1d58f1b5ef93c1cf9821c29 (diff)
downloadhdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.zip
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.gz
hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.bz2
Fix some const cast and stack/static object size warnings (#1700)
* Fix various warnings * Move HDfree_const to H5private.h for wider use * Print output from all ranks in parallel tests on allocation failure * Move const pointer freeing macro to h5test.h for now
Diffstat (limited to 'testpar/t_pflush2.c')
-rw-r--r--testpar/t_pflush2.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c
index 8cf40d0..af2e57d 100644
--- a/testpar/t_pflush2.c
+++ b/testpar/t_pflush2.c
@@ -26,7 +26,7 @@
const char *FILENAME[] = {"flush", "noflush", NULL};
-static int data_g[100][100];
+static int *data_g = NULL;
#define N_GROUPS 100
@@ -77,9 +77,10 @@ check_test_file(char *name, size_t name_length, hid_t fapl_id)
for (i = 0; i < dims[0]; i++) {
for (j = 0; j < dims[1]; j++) {
val = (int)(i + (i * j) + j);
- if (data_g[i][j] != val) {
+ if (data_g[(i * 100) + j] != val) {
H5_FAILED();
- HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]);
+ HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j,
+ data_g[(i * 100) + j]);
HDprintf(" should be %d\n", val);
}
}
@@ -170,6 +171,9 @@ main(int argc, char *argv[])
HDexit(EXIT_SUCCESS);
}
+ if (NULL == (data_g = HDmalloc(100 * 100 * sizeof(*data_g))))
+ goto error;
+
if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
if (H5Pset_fapl_mpio(fapl_id1, comm, info) < 0)
@@ -213,10 +217,18 @@ main(int argc, char *argv[])
h5_clean_files(&FILENAME[0], fapl_id1);
h5_clean_files(&FILENAME[1], fapl_id2);
+ if (data_g) {
+ HDfree(data_g);
+ data_g = NULL;
+ }
+
MPI_Finalize();
HDexit(EXIT_SUCCESS);
error:
+ if (data_g)
+ HDfree(data_g);
+
HDexit(EXIT_FAILURE);
} /* end main() */