diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2014-04-11 14:48:31 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2014-04-11 14:48:31 (GMT) |
commit | 8a524752454c04a07a378b39abc929fd8948d91b (patch) | |
tree | e6ad7cc080461c68bdc7dda04df9da07026ce3a2 /test | |
parent | 6240fb24e6e06039dada4bc7e23ca1a211a0ab2c (diff) | |
download | hdf5-8a524752454c04a07a378b39abc929fd8948d91b.zip hdf5-8a524752454c04a07a378b39abc929fd8948d91b.tar.gz hdf5-8a524752454c04a07a378b39abc929fd8948d91b.tar.bz2 |
[svn-r25014] Purpose:
Merge of r24937 from the trunk
Adds H5free_memory to the API. This function should be used to free
memory allocated by the library (e.g., returned values from
H5Tget_tag, H5Pget_class_name, etc.).
This is mainly to help Windows applications deal with multiple CRT
instances, but can also be helpful when a debug memory manager is
being used or when the HDF5 API is being wrapped for managed languages
like Python and Java.
Tested on:
32-bit LE linux (jam) with fortran and C++
64-bit BE linux (ostrich)
64-bit LE linux (koala)
Diffstat (limited to 'test')
-rw-r--r-- | test/dtypes.c | 13 | ||||
-rw-r--r-- | test/err_compat.c | 16 | ||||
-rw-r--r-- | test/tarray.c | 22 | ||||
-rw-r--r-- | test/tattr.c | 2 | ||||
-rw-r--r-- | test/tgenprop.c | 10 | ||||
-rw-r--r-- | test/tunicode.c | 4 |
6 files changed, 33 insertions, 34 deletions
diff --git a/test/dtypes.c b/test/dtypes.c index ae74202..de81bd5 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -651,7 +651,7 @@ test_compound_1(void) error: if(tag) - HDfree(tag); + H5free_memory(tag); return retval; } @@ -4423,7 +4423,7 @@ error: if(buf) HDfree(buf); if(tag) - HDfree(tag); + H5free_memory(tag); /* Technically allocated by API call */ reset_hdf5(); return ret_value; /* Number of errors */ @@ -4791,8 +4791,7 @@ test_bitfield_funcs(void) error: if (retval == -1) retval = 1; - - HDfree(tag); + H5free_memory(tag); H5Tclose(ntype); H5Tclose(type); if (retval == 0) PASSED(); @@ -6474,7 +6473,7 @@ test_named_indirect_reopen(hid_t fapl) if(dt_size != H5Tget_size(type)) TEST_ERROR if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR if(HDstrcmp(tag, tag_ret)) TEST_ERROR - HDfree(tag_ret); + H5free_memory(tag_ret); tag_ret = NULL; /* Create dataset with opaque type */ @@ -6485,7 +6484,7 @@ test_named_indirect_reopen(hid_t fapl) if(dt_size != H5Tget_size(reopened_type)) TEST_ERROR if(NULL == (tag_ret = H5Tget_tag(type))) TEST_ERROR if(HDstrcmp(tag, tag_ret)) TEST_ERROR - HDfree(tag_ret); + H5free_memory(tag_ret); tag_ret = NULL; /* Close types and dataset */ @@ -6535,7 +6534,7 @@ error: H5Fclose(file); } H5E_END_TRY; if(tag_ret) - HDfree(tag_ret); + H5free_memory(tag_ret); return 1; } /* end test_named_indirect_reopen() */ diff --git a/test/err_compat.c b/test/err_compat.c index c08e259..346d397 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -144,16 +144,16 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); - HDfree(maj); - HDfree(min); + H5free_memory(maj); + H5free_memory(min); return 0; error: if(maj) - HDfree(maj); + H5free_memory(maj); if(min) - HDfree(min); + H5free_memory(min); return -1; } @@ -197,16 +197,16 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); - HDfree(maj); - HDfree(min); + H5free_memory(maj); + H5free_memory(min); return 0; error: if(maj) - HDfree(maj); + H5free_memory(maj); if(min) - HDfree(min); + H5free_memory(min); return -1; } diff --git a/test/tarray.c b/test/tarray.c index 2f0b002..2d6581b 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -637,7 +637,7 @@ test_array_compound_atomic(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname, "i") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); - free(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off = H5Tget_member_offset(tid2, 0); @@ -656,7 +656,7 @@ test_array_compound_atomic(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname, "f") != 0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n", mname); - free(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off = H5Tget_member_offset(tid2, 1); @@ -849,7 +849,7 @@ test_array_compound_array(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - free(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid2,0); @@ -868,7 +868,7 @@ test_array_compound_array(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - free(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid2,1); @@ -1855,7 +1855,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - free(mname); + H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid1,0); @@ -1874,7 +1874,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - free(mname); + H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid1,1); @@ -1893,7 +1893,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - free(mname); + H5free_memory(mname); /* Check the 3rd field's offset */ off=H5Tget_member_offset(tid1,2); @@ -1937,7 +1937,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"i")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) free(mname); + if(mname) H5free_memory(mname); /* Check the 1st field's offset */ off=H5Tget_member_offset(tid1,0); @@ -1956,7 +1956,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"f")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) free(mname); + if(mname) H5free_memory(mname); /* Check the 2nd field's offset */ off=H5Tget_member_offset(tid1,1); @@ -2001,7 +2001,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"l")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) free(mname); + if(mname) H5free_memory(mname); /* Check the 3rd field's offset */ off=H5Tget_member_offset(tid1,2); @@ -2046,7 +2046,7 @@ test_compat(void) CHECK(mname, NULL, "H5Tget_member_name"); if(mname && HDstrcmp(mname,"d")!=0) TestErrPrintf("Compound field name doesn't match!, mname=%s\n",mname); - if(mname) free(mname); + if(mname) H5free_memory(mname); /* Check the 4th field's offset */ off=H5Tget_member_offset(tid1,3); diff --git a/test/tattr.c b/test/tattr.c index b23080c..e9430fe 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -829,7 +829,7 @@ test_attr_compound_read(hid_t fapl) HDstrcmp(fieldname, ATTR4_FIELDNAME2) || HDstrcmp(fieldname, ATTR4_FIELDNAME3))) TestErrPrintf("invalid field name for field #%d: %s\n", i, fieldname); - free(fieldname); + H5free_memory(fieldname); } /* end for */ offset = H5Tget_member_offset(type, 0); VERIFY(offset, attr4_field1_off, "H5Tget_member_offset"); diff --git a/test/tgenprop.c b/test/tgenprop.c index f304f11..4e93dd5 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -88,7 +88,7 @@ test_genprop_basic_class(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - free(name); + H5free_memory(name); /* Check class parent */ cid2 = H5Pget_class_parent(cid1); @@ -119,7 +119,7 @@ test_genprop_basic_class(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS2_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME); - free(name); + H5free_memory(name); /* Check class parent */ cid2 = H5Pget_class_parent(cid1); @@ -1868,7 +1868,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close class */ ret = H5Pclose_class(cid1); @@ -1887,7 +1887,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close list */ ret = H5Pclose(lid1); @@ -1898,7 +1898,7 @@ test_genprop_refcount(void) CHECK_PTR(name, "H5Pget_class_name"); if(HDstrcmp(name,CLASS1_NAME)!=0) TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME); - HDfree(name); + H5free_memory(name); /* Close class */ ret = H5Pclose_class(cid1); diff --git a/test/tunicode.c b/test/tunicode.c index 9725a9b..6f3e3a9 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -602,7 +602,7 @@ void test_compound(hid_t fid, const char * string) readbuf = H5Tget_member_name(s1_tid, 0); ret = HDstrcmp(readbuf, string); VERIFY(ret, 0, "strcmp"); - free(readbuf); + H5free_memory(readbuf); /* Add the other fields to the datatype */ ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); @@ -715,7 +715,7 @@ void test_opaque(hid_t UNUSED fid, const char * string) read_buf = H5Tget_tag(type_id); ret = strcmp(read_buf, string); VERIFY(ret, 0, "H5Tget_tag"); - free(read_buf); + H5free_memory(read_buf); ret = H5Tclose(type_id); CHECK(ret, FAIL, "H5Tclose"); |