summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2013-10-31 04:20:36 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2013-10-31 04:20:36 (GMT)
commite6cace9ee46e903a8612aba7d9d1d72fa0968217 (patch)
treeac7d07ea06d3d5ac73e34bc54ff17620a4d083fe /test/dtypes.c
parent2eb24b16dac78b3e27769c20502299475fb8dde6 (diff)
downloadhdf5-e6cace9ee46e903a8612aba7d9d1d72fa0968217.zip
hdf5-e6cace9ee46e903a8612aba7d9d1d72fa0968217.tar.gz
hdf5-e6cace9ee46e903a8612aba7d9d1d72fa0968217.tar.bz2
[svn-r24376] Updated all code to use HDmalloc, HDcalloc, and HDfree.
Prep work for adding a memory free function, part of HDFFV-8551. Tested on: 32-bit LE linux (jam) * with C++, Fortran * with thread safety on These are minor changes (almost entirely renaming foo functions to HDfoo) that don't change functionality. This should not require a full commit test.
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index de64713..e0bc2ae 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -697,9 +697,9 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)malloc(nelmts * sizeof(struct st));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)orig) + i;
s_ptr->a = i*8+0;
@@ -762,9 +762,9 @@ test_compound_2(void)
}
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
CHECK_NMEMBS(nmembs , st, dt)
PASSED();
@@ -818,9 +818,9 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)malloc(nelmts * sizeof(struct st));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)orig) + i;
s_ptr->a = i*8+0;
@@ -880,9 +880,9 @@ test_compound_3(void)
}
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
@@ -940,9 +940,9 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)malloc(nelmts * sizeof(struct st));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)orig) + i;
s_ptr->a = i*8+0;
@@ -1006,9 +1006,9 @@ test_compound_4(void)
}
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
@@ -1175,9 +1175,9 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char*)malloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char*)malloc(nelmts * sizeof(struct dt));
- orig = (unsigned char*)malloc(nelmts * sizeof(struct st));
+ buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
+ bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
+ orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)orig) + i;
s_ptr->b = (i*8+1) & 0x7fff;
@@ -1223,9 +1223,9 @@ test_compound_6(void)
}
/* Release resources */
- free(buf);
- free(bkg);
- free(orig);
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
CHECK_NMEMBS(nmembs, st, dt)
PASSED();
@@ -1790,7 +1790,7 @@ test_compound_9(void)
} /* end if */
rdata.i1 = rdata.i2 = 0;
- if(rdata.str) free(rdata.str);
+ if(rdata.str) HDfree(rdata.str);
if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
@@ -1804,7 +1804,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if(rdata.str) free(rdata.str);
+ if(rdata.str) HDfree(rdata.str);
if(H5Dclose(dset_id) < 0)
goto error;
@@ -1983,10 +1983,10 @@ test_compound_10(void)
goto error;
}
- free(t1);
- free(t2);
- free(wdata[i].str);
- free(rdata[i].str);
+ HDfree(t1);
+ HDfree(t2);
+ HDfree(wdata[i].str);
+ HDfree(rdata[i].str);
} /* end for */
if(H5Dclose(dset_id) < 0)
@@ -4547,7 +4547,7 @@ test_conv_enum_2(void)
H5Tenum_insert(dsttype, mname[i], &i);
/* Source data */
- data = (int*)malloc(NTESTELEM*sizeof(int));
+ data = (int*)HDmalloc(NTESTELEM*sizeof(int));
for (i=0; i<NTESTELEM; i++) {
((char*)data)[i*3+2] = (char)(i % 8);
((char*)data)[i*3+0] = 0;
@@ -4569,7 +4569,7 @@ test_conv_enum_2(void)
}
/* Cleanup */
- free(data);
+ HDfree(data);
H5Tclose(srctype);
H5Tclose(dsttype);
H5Tclose(oddsize);
@@ -5387,7 +5387,7 @@ test_encode(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
- free(cmpd_buf);
+ HDfree(cmpd_buf);
cmpd_buf_size = 0;
/* Commit enumeration datatype and close it */
@@ -5406,7 +5406,7 @@ test_encode(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
- free(enum_buf);
+ HDfree(enum_buf);
enum_buf_size = 0;
/* Commit enumeration datatype and close it */
@@ -5425,7 +5425,7 @@ test_encode(void)
printf("Can't close datatype\n");
goto error;
} /* end if */
- free(vlstr_buf);
+ HDfree(vlstr_buf);
vlstr_buf_size = 0;
/* Open the dataytpe for query */
@@ -5543,7 +5543,7 @@ test_encode(void)
printf("Can't decode VL string type\n");
goto error;
} /* end if */
- free(vlstr_buf);
+ HDfree(vlstr_buf);
/* Verify that the datatype was copied exactly */
if(H5Tequal(decoded_tid3, tid3)<=0) {
@@ -5656,8 +5656,8 @@ test_encode(void)
goto error;
} /* end if */
- free(cmpd_buf);
- free(enum_buf);
+ HDfree(cmpd_buf);
+ HDfree(enum_buf);
PASSED();
return 0;