diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2013-10-31 04:20:36 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2013-10-31 04:20:36 (GMT) |
commit | e6cace9ee46e903a8612aba7d9d1d72fa0968217 (patch) | |
tree | ac7d07ea06d3d5ac73e34bc54ff17620a4d083fe /c++ | |
parent | 2eb24b16dac78b3e27769c20502299475fb8dde6 (diff) | |
download | hdf5-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 'c++')
-rw-r--r-- | c++/test/tcompound.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 28d8a1e..6ae3f82 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -122,9 +122,9 @@ static void test_compound_2() SUBTEST("Compound Element Reordering"); try { // Sizes should be the same, but be careful just in case - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -190,9 +190,9 @@ static void test_compound_2() } } // Release resources - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -247,9 +247,9 @@ static void test_compound_3() SUBTEST("Compound Datatype Subset Conversions"); try { /* Initialize */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -312,9 +312,9 @@ static void test_compound_3() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -374,9 +374,9 @@ static void test_compound_4() SUBTEST("Compound Element Shrinking & Reordering"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->a = i*8+0; @@ -444,9 +444,9 @@ static void test_compound_4() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); @@ -499,8 +499,8 @@ static void test_compound_5() src_typ_t src[2] = {{"one", 102, {104, 105, 106, 107}}, {"two", 202, {204, 205, 206, 207}}}; dst_typ_t *dst; - void *buf = calloc(2, sizeof(dst_typ_t)); - void *bkg = calloc(2, sizeof(dst_typ_t)); + void *buf = HDcalloc(2, sizeof(dst_typ_t)); + void *bkg = HDcalloc(2, sizeof(dst_typ_t)); ArrayType* array_dt = NULL; // Output message about test being performed @@ -552,8 +552,8 @@ static void test_compound_5() { H5_FAILED(); } /* Free memory buffers */ - free(buf); - free(bkg); + HDfree(buf); + HDfree(bkg); dst = NULL; PASSED(); } // end of try block @@ -606,9 +606,9 @@ static void test_compound_6() SUBTEST("Compound Element Growing"); try { /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char*)malloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); - bkg = (unsigned char*)malloc(nelmts * sizeof(dst_typ_t)); - orig = (unsigned char*)malloc(nelmts * sizeof(src_typ_t)); + buf = (unsigned char*)HDmalloc(nelmts * MAX(sizeof(src_typ_t), sizeof(dst_typ_t))); + bkg = (unsigned char*)HDmalloc(nelmts * sizeof(dst_typ_t)); + orig = (unsigned char*)HDmalloc(nelmts * sizeof(src_typ_t)); for (i=0; i<nelmts; i++) { s_ptr = ((src_typ_t*)orig) + i; s_ptr->b = (i*8+1) & 0x7fff; @@ -645,9 +645,9 @@ static void test_compound_6() } // for /* Release resources */ - free(buf); - free(bkg); - free(orig); + HDfree(buf); + HDfree(bkg); + HDfree(orig); s_ptr = NULL; d_ptr = NULL; st.close(); |