diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 22:48:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 22:48:12 (GMT) |
commit | aebac33a1f290fa5065bce96bb0512317a34c283 (patch) | |
tree | cdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /c++/test/tvlstr.cpp | |
parent | 605cea4af60cfcbe03a54f697de392eec75e5a85 (diff) | |
download | hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2 |
Remove HD from memory allocate/free calls (#3195)
* HDcalloc
* HDfree
* HDmalloc
* HDrealloc
Diffstat (limited to 'c++/test/tvlstr.cpp')
-rw-r--r-- | c++/test/tvlstr.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 1cde7f1..3f5848e 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -65,7 +65,7 @@ static void *test_vlstr_alloc_custom(size_t size, void *info) extra=MAX(sizeof(void *),sizeof(size_t)); - if((ret_value=HDmalloc(extra+size))!=NULL) { + if((ret_value=malloc(extra+size))!=NULL) { *(size_t *)ret_value=size; *mem_used+=size; } // end if @@ -108,7 +108,7 @@ static void test_vlstr_free_custom(void *_mem, void *info) if(_mem!=NULL) { mem=((unsigned char *)_mem)-extra; *mem_used-=*(size_t *)mem; - HDfree(mem); + free(mem); } // end if } #endif @@ -166,7 +166,7 @@ test_vlstring_dataset() TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n", __LINE__, DSET1_DATA.c_str(), string_ds_check); - HDfree(string_ds_check); // note: no need for std::string test + free(string_ds_check); // note: no need for std::string test string_ds_check = NULL; // Read and verify the dataset string as an std::string. @@ -182,7 +182,7 @@ test_vlstring_dataset() // Test scalar type dataset with 1 value. dset1 = root.createDataSet("test_scalar_small", vlst, ds_space); - dynstring_ds_write = static_cast<char *>(HDcalloc(2, sizeof(char))); + dynstring_ds_write = static_cast<char *>(calloc(2, sizeof(char))); HDmemset(dynstring_ds_write, 'A', 1); // Write data to the dataset, then read it back. @@ -193,7 +193,7 @@ test_vlstring_dataset() if (HDstrcmp(string_ds_check, dynstring_ds_write) != 0) TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n", dynstring_ds_write, string_ds_check); - HDfree(string_ds_check); + free(string_ds_check); string_ds_check = NULL; dset1.close(); @@ -213,9 +213,9 @@ test_vlstring_dataset() } if (dynstring_ds_write) - HDfree(dynstring_ds_write); + free(dynstring_ds_write); if (string_ds_check) - HDfree(string_ds_check); + free(string_ds_check); } // test_vlstring_dataset() /*------------------------------------------------------------------------- @@ -268,7 +268,7 @@ test_vlstring_array_dataset() TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__, string_ds_array[ii], string_ds_check[ii]); - HDfree(string_ds_check[ii]); + free(string_ds_check[ii]); } // Close objects that are no longer needed. @@ -284,7 +284,7 @@ test_vlstring_array_dataset() // Create and write another dataset. DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space)); - char *wdata2 = static_cast<char *>(HDcalloc(65534, sizeof(char))); + char *wdata2 = static_cast<char *>(calloc(65534, sizeof(char))); HDmemset(wdata2, 'A', 65533); dataset2.write(&wdata2, vlst); @@ -296,8 +296,8 @@ test_vlstring_array_dataset() // Release resources from second dataset operation. scalar_space.close(); dataset2.close(); - HDfree(wdata2); - HDfree(rdata2); + free(wdata2); + free(rdata2); // Close objects and file. dataset2.close(); @@ -662,7 +662,7 @@ test_vlstring_attribute() TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n", __LINE__, ATTRSTR_DATA.c_str(), string_att_check); - HDfree(string_att_check); // note: no need for std::string test + free(string_att_check); // note: no need for std::string test // Read and verify the attribute string as an std::string. H5std_string read_str; @@ -677,7 +677,7 @@ test_vlstring_attribute() // Test creating a "large" sized string attribute gr_attr = root.createAttribute("test_scalar_large", vlst, att_space); - string_att_write = static_cast<char *>(HDcalloc(8192, sizeof(char))); + string_att_write = static_cast<char *>(calloc(8192, sizeof(char))); HDmemset(string_att_write, 'A', 8191); // Write data to the attribute, then read it back. @@ -690,8 +690,8 @@ test_vlstring_attribute() string_att_write, string_att_check); // Release resources. - HDfree(string_att_check); - HDfree(string_att_write); + free(string_att_check); + free(string_att_write); gr_attr.close(); file1.close(); @@ -739,7 +739,7 @@ static void test_read_vl_string_attribute() att.read(vlst, &string_att_check); if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check); - HDfree(string_att_check); + free(string_att_check); att.close(); // Test reading "large" sized string attribute @@ -747,8 +747,8 @@ static void test_read_vl_string_attribute() att.read(vlst, &string_att_check); if(HDstrcmp(string_att_check,string_att_write)!=0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); - HDfree(string_att_write); // Free string allocated in test_write_vl_string_attribute + free(string_att_check); + free(string_att_write); // Free string allocated in test_write_vl_string_attribute // Close objects and file. att.close(); @@ -821,7 +821,7 @@ test_vlstring_array_attribute() TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n", __LINE__, string_att_check[ii], string_att_check[ii]); - HDfree(string_att_check[ii]); // note: no need for std::string test + free(string_att_check[ii]); // note: no need for std::string test } // Close group's attribute. @@ -869,7 +869,7 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha if (HDstrcmp(data, data_read) != 0) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); - HDfree(data_read); + free(data_read); } // end try catch (FileIException &ferr) { throw; |