summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-02-25 22:21:11 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-02-25 22:21:11 (GMT)
commit44003b135f9530f929ff7d2b30c79092704e32a8 (patch)
treef214b164bee52a380bad4639c908d6224cf6e79e /tools
parent167553f64d192da9a31ccfe094e5778719ae4d85 (diff)
downloadhdf5-44003b135f9530f929ff7d2b30c79092704e32a8.zip
hdf5-44003b135f9530f929ff7d2b30c79092704e32a8.tar.gz
hdf5-44003b135f9530f929ff7d2b30c79092704e32a8.tar.bz2
Change to dynamic allocation for buffer
Diffstat (limited to 'tools')
-rw-r--r--tools/test/misc/h5repart_gentest.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c
index bfa8187..bd94104 100644
--- a/tools/test/misc/h5repart_gentest.c
+++ b/tools/test/misc/h5repart_gentest.c
@@ -25,7 +25,8 @@
#define FAMILY_SIZE 1024
#define FILENAME "family_file%05d.h5"
-static int buf[FAMILY_NUMBER][FAMILY_SIZE];
+int **buf = NULL;
+int *buf_data = NULL;
int main(void)
{
@@ -34,6 +35,18 @@ int main(void)
int i, j;
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) {
+ HDperror("HDcalloc");
+ HDexit(EXIT_FAILURE);
+ }
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) {
+ HDperror("HDcalloc");
+ HDexit(EXIT_FAILURE);
+ }
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
/* Set property list and file name for FAMILY driver */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
HDperror("H5Pcreate");
@@ -93,6 +106,9 @@ int main(void)
HDexit(EXIT_FAILURE);
}
+ HDfree(buf);
+ HDfree(buf_data);
+
HDputs(" PASSED");
HDfflush(stdout);