summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--c++/test/tcompound.cpp56
-rw-r--r--fortran/src/H5Df.c40
-rw-r--r--fortran/src/H5Sf.c4
-rw-r--r--hl/fortran/src/H5IMcc.c4
-rw-r--r--hl/fortran/src/H5IMfc.c32
-rw-r--r--hl/fortran/src/H5LTfc.c66
-rw-r--r--hl/src/H5DS.c94
-rw-r--r--hl/src/H5HLprivate2.h40
-rw-r--r--hl/src/H5IM.c12
-rw-r--r--hl/src/H5LT.c5
-rw-r--r--hl/src/H5PT.c36
-rw-r--r--hl/src/H5TB.c118
-rw-r--r--hl/src/hdf5_hl.h2
-rw-r--r--hl/test/gen_test_ds.c4
-rw-r--r--hl/test/test_dset_opt.c10
-rw-r--r--hl/test/test_file_image.c10
-rw-r--r--test/accum.c8
-rw-r--r--test/cmpd_dset.c32
-rw-r--r--test/dsets.c10
-rw-r--r--test/dt_arith.c74
-rw-r--r--test/dtypes.c76
-rw-r--r--test/h5test.c2
-rw-r--r--test/ntypes.c4
-rw-r--r--test/tarray.c28
-rw-r--r--test/tattr.c2
-rw-r--r--test/tgenprop.c6
-rw-r--r--test/tid.c14
-rw-r--r--test/tmisc.c2
-rw-r--r--test/trefer.c40
-rw-r--r--test/tselect.c36
-rw-r--r--test/tsohm.c4
-rw-r--r--test/ttsafe_acreate.c4
-rw-r--r--test/ttsafe_cancel.c4
-rw-r--r--test/tunicode.c4
-rw-r--r--tools/h5copy/h5copygentest.c12
-rw-r--r--tools/h5diff/h5diff_common.c2
-rw-r--r--tools/h5diff/h5diffgentest.c22
-rw-r--r--tools/h5jam/getub.c4
-rw-r--r--tools/h5repack/h5repacktst.c32
-rw-r--r--tools/h5stat/h5stat.c8
-rw-r--r--tools/misc/h5repart.c4
-rw-r--r--tools/misc/talign.c10
42 files changed, 479 insertions, 498 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();
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index ab7adf7..deab4f3 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -1582,7 +1582,7 @@ nh5dvlen_get_max_len_c ( hid_t_f *dset_id , hid_t_f *type_id, hid_t_f *space_id
num_elem = H5Sget_select_npoints(c_space_id);
if( num_elem < 0) return ret_value;
- c_buf = (hvl_t *)malloc(sizeof(hvl_t)*(size_t)num_elem);
+ c_buf = (hvl_t *)HDmalloc(sizeof(hvl_t)*(size_t)num_elem);
if (c_buf == NULL) return ret_value;
status = H5Dread(c_dset_id, c_type_id, H5S_ALL, c_space_id, H5P_DEFAULT, c_buf);
if(status < 0) goto DONE;
@@ -1595,7 +1595,7 @@ nh5dvlen_get_max_len_c ( hid_t_f *dset_id , hid_t_f *type_id, hid_t_f *space_id
DONE:
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
/****if* H5Df/nh5dwrite_vl_integer_c
@@ -1651,7 +1651,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_
c_file_space_id = (hid_t)*file_space_id;
c_xfer_prp = (hid_t)*xfer_prp;
- c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t));
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
if (c_buf == NULL) return ret_value;
tmp = (int_f *)buf;
for (i=0; i < num_elem; i++) {
@@ -1667,7 +1667,7 @@ nh5dwrite_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_
if( status < 0) goto DONE;
ret_value = 0;
DONE:
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -1725,7 +1725,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s
num_elem = H5Sget_select_npoints(c_mem_space_id);
if(num_elem != dims[1]) return ret_value;
- c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t));
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
if (c_buf == NULL) return ret_value;
/*
* Call H5Dread function.
@@ -1739,7 +1739,7 @@ nh5dread_vl_integer_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_s
H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
ret_value = 0;
DONE:
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -1798,12 +1798,12 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp
/*
* Allocate arra of character pointers
*/
- c_buf = (char **)malloc((size_t)num_elem * sizeof(char *));
+ c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
if (c_buf == NULL) return ret_value;
/* Copy data to long C string */
tmp = (char *)HD5f2cstring(buf, (size_t)(max_len*num_elem));
- if (tmp == NULL) { free(c_buf);
+ if (tmp == NULL) { HDfree(c_buf);
return ret_value;
}
/*
@@ -1811,7 +1811,7 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp
*/
tmp_p = tmp;
for (i=0; i < num_elem; i++) {
- c_buf[i] = (char *) malloc((size_t)len[i]+1);
+ c_buf[i] = (char *) HDmalloc((size_t)len[i]+1);
memcpy(c_buf[i], tmp_p, (size_t)len[i]);
c_buf[i][len[i]] = '\0';
tmp_p = tmp_p + max_len;
@@ -1826,8 +1826,8 @@ nh5dwrite_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_sp
ret_value = 0;
DONE:
H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- free(c_buf);
- free(tmp);
+ HDfree(c_buf);
+ HDfree(tmp);
return ret_value;
}
/****if* H5Df/nh5dread_vl_string_c
@@ -1885,18 +1885,18 @@ nh5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
/*
* Allocate array of character pointers
*/
- c_buf = (char **)malloc((size_t)num_elem * sizeof(char *));
+ c_buf = (char **)HDmalloc((size_t)num_elem * sizeof(char *));
if (c_buf == NULL) return ret_value;
/*
* Call H5Dread function.
*/
status = H5Dread(c_dset_id, c_mem_type_id, c_mem_space_id, c_file_space_id, c_xfer_prp, c_buf);
- if (status < 0) { free(c_buf);
+ if (status < 0) { HDfree(c_buf);
return ret_value;
}
/* Copy data to long C string */
- tmp = (char *)malloc((size_t)(max_len*num_elem) +1);
+ tmp = (char *)HDmalloc((size_t)(max_len*num_elem) +1);
tmp_p = tmp;
for (i=0; i<max_len*num_elem; i++) tmp[i] = ' ';
tmp[max_len*num_elem] = '\0';
@@ -1908,8 +1908,8 @@ nh5dread_vl_string_c( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
HD5packFstring(tmp, _fcdtocp(buf), (size_t)(max_len*num_elem));
ret_value = 0;
H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
- free(c_buf);
- free(tmp);
+ HDfree(c_buf);
+ HDfree(tmp);
return ret_value;
}
@@ -1966,7 +1966,7 @@ nh5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
c_file_space_id = (hid_t)*file_space_id;
c_xfer_prp = (hid_t)*xfer_prp;
- c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t));
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
if (c_buf == NULL) return ret_value;
tmp = (real_f *)buf;
for (i=0; i < num_elem; i++) {
@@ -1982,7 +1982,7 @@ nh5dwrite_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spa
if( status < 0) goto DONE;
ret_value = 0;
DONE:
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -2040,7 +2040,7 @@ nh5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac
num_elem = H5Sget_select_npoints(c_mem_space_id);
if(num_elem != dims[1]) return ret_value;
- c_buf = (hvl_t *)malloc((size_t)num_elem * sizeof(hvl_t));
+ c_buf = (hvl_t *)HDmalloc((size_t)num_elem * sizeof(hvl_t));
if (c_buf == NULL) return ret_value;
/*
* Call H5Dread function.
@@ -2055,7 +2055,7 @@ nh5dread_vl_real_c ( hid_t_f *dset_id , hid_t_f *mem_type_id, hid_t_f *mem_spac
H5Dvlen_reclaim(c_mem_type_id, c_mem_space_id, H5P_DEFAULT, c_buf);
ret_value = 0;
DONE:
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 2cfb1eb..a944e20 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -298,7 +298,7 @@ nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock,
if (rank < 0 ) return ret_value;
c_startblock = (hsize_t)*startblock;
- c_buf = (hsize_t*)malloc(sizeof(hsize_t)*(size_t)(c_num_blocks*2*rank));
+ c_buf = (hsize_t*)HDmalloc(sizeof(hsize_t)*(size_t)(c_num_blocks*2*rank));
if (!c_buf) return ret_value;
ret_value = H5Sget_select_hyper_blocklist(c_space_id, c_startblock,
@@ -425,7 +425,7 @@ nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint,
if (rank < 0 ) return ret_value;
c_startpoint = (hsize_t)*startpoint;
- c_buf = (hsize_t*)malloc(sizeof(hsize_t)*(size_t)(c_num_points*rank));
+ c_buf = (hsize_t*)HDmalloc(sizeof(hsize_t)*(size_t)(c_num_points*rank));
if (!c_buf) return ret_value;
ret_value = H5Sget_select_elem_pointlist(c_space_id, c_startpoint,
c_num_points, c_buf);
diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c
index 22a7a3e..b4ea067 100644
--- a/hl/fortran/src/H5IMcc.c
+++ b/hl/fortran/src/H5IMcc.c
@@ -505,7 +505,7 @@ herr_t H5IM_get_palette(hid_t loc_id,
dim_ref = n_refs;
- refbuf = malloc(sizeof(hobj_ref_t) * (int)dim_ref);
+ refbuf = HDmalloc(sizeof(hobj_ref_t) * (int)dim_ref);
if(H5Aread(attr_id, attr_type, refbuf) < 0)
goto out;
@@ -525,7 +525,7 @@ herr_t H5IM_get_palette(hid_t loc_id,
if(H5Dclose(pal_id) < 0)
goto out;
- free(refbuf);
+ HDfree(refbuf);
} /* H5T_REFERENCE */
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index 818096e..39cb990 100644
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -75,7 +75,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
@@ -135,7 +135,7 @@ nh5imread_image_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -206,9 +206,9 @@ nh5immake_image_24bit_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_il!=NULL)
- free(c_il);
+ HDfree(c_il);
return ret_value;
}
@@ -265,7 +265,7 @@ nh5imget_image_info_c(hid_t_f *loc_id,
/*
* allocate buffer to hold name of an attribute
*/
- if ((c_buf = malloc((size_t)*ilen +1)) == NULL)
+ if ((c_buf = HDmalloc((size_t)*ilen +1)) == NULL)
goto done;
/*
@@ -292,9 +292,9 @@ nh5imget_image_info_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_buf!=NULL)
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -344,7 +344,7 @@ nh5imis_image_c(hid_t_f *loc_id,
ret = H5IMis_image(c_loc_id, c_name);
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret;
@@ -467,9 +467,9 @@ nh5imlink_palette_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_namepal!=NULL)
- free(c_namepal);
+ HDfree(c_namepal);
return ret_value;
}
@@ -537,9 +537,9 @@ nh5imunlink_palette_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_namepal!=NULL)
- free(c_namepal);
+ HDfree(c_namepal);
return ret_value;
}
@@ -602,7 +602,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -672,7 +672,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -733,7 +733,7 @@ nh5imget_palette_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -783,7 +783,7 @@ nh5imis_palette_c(hid_t_f *loc_id,
ret = H5IMis_palette(c_loc_id, c_name);
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret;
diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c
index 674636d..4f8f7b6 100644
--- a/hl/fortran/src/H5LTfc.c
+++ b/hl/fortran/src/H5LTfc.c
@@ -64,7 +64,7 @@ nh5ltmake_dataset_c (hid_t_f *loc_id,
if (c_name == NULL)
goto done;
- c_dims = malloc(sizeof(hsize_t) * (*rank ));
+ c_dims = HDmalloc(sizeof(hsize_t) * (*rank ));
if (c_dims == NULL)
goto done;
@@ -91,9 +91,9 @@ nh5ltmake_dataset_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_dims!=NULL)
- free(c_dims);
+ HDfree(c_dims);
return ret_value;
}
@@ -616,7 +616,7 @@ nh5ltread_dataset_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -1102,9 +1102,9 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_buf!=NULL)
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -1163,7 +1163,7 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -1242,9 +1242,9 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -1314,9 +1314,9 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -1388,9 +1388,9 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -1467,11 +1467,11 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
if(c_buf!=NULL)
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -1545,9 +1545,9 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
@@ -1616,9 +1616,9 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -1686,9 +1686,9 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -1762,11 +1762,11 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
if(c_buf!=NULL)
- free(c_buf);
+ HDfree(c_buf);
return ret_value;
}
@@ -1828,7 +1828,7 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -1878,7 +1878,7 @@ nh5ltfind_dataset_c(hid_t_f *loc_id,
ret = H5LTfind_dataset(c_loc_id, c_name);
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret;
@@ -1960,7 +1960,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
return ret_value;
}
@@ -2030,9 +2030,9 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
}
@@ -2123,9 +2123,9 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id,
done:
if(c_name!=NULL)
- free(c_name);
+ HDfree(c_name);
if(c_attrname!=NULL)
- free(c_attrname);
+ HDfree(c_attrname);
return ret_value;
@@ -2177,7 +2177,7 @@ nh5ltpath_valid_c(hid_t_f *loc_id,
done:
if(c_path != NULL)
- free(c_path);
+ HDfree(c_path);
return (int_f)ret;
}
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 5f8cd50..06ce078 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -254,7 +254,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -265,7 +265,7 @@ herr_t H5DSattach_scale(hid_t did,
/* store the REF information in the index of the dataset that has the DS */
buf[idx].len = 1;
- buf[idx].p = malloc( 1 * sizeof(hobj_ref_t));
+ buf[idx].p = HDmalloc( 1 * sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds;
/* write the attribute with the reference */
@@ -282,7 +282,7 @@ herr_t H5DSattach_scale(hid_t did,
if(H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
}
@@ -303,7 +303,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -343,13 +343,13 @@ herr_t H5DSattach_scale(hid_t did,
if(buf[idx].len > 0) {
buf[idx].len++;
len = buf[idx].len;
- buf[idx].p = realloc(buf[idx].p, len * sizeof(hobj_ref_t));
+ buf[idx].p = HDrealloc(buf[idx].p, len * sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[len - 1] = ref_to_ds;
} /* end if */
else {
/* store the REF information in the index of the dataset that has the DS */
buf[idx].len = 1;
- buf[idx].p = malloc(sizeof(hobj_ref_t));
+ buf[idx].p = HDmalloc(sizeof(hobj_ref_t));
((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds;
} /* end else */
} /* end if */
@@ -367,7 +367,7 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
if(H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
} /* has_dimlist */
@@ -447,7 +447,7 @@ herr_t H5DSattach_scale(hid_t did,
nelmts++;
- dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t));
+ dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
if(dsbuf == NULL)
goto out;
@@ -497,7 +497,7 @@ herr_t H5DSattach_scale(hid_t did,
if (H5Tclose(ntid) < 0)
goto out;
- free(dsbuf);
+ HDfree(dsbuf);
dsbuf = NULL;
} /* has_reflist */
@@ -519,9 +519,9 @@ herr_t H5DSattach_scale(hid_t did,
/* error zone */
out:
if(buf)
- free(buf);
+ HDfree(buf);
if(dsbuf)
- free(dsbuf);
+ HDfree(dsbuf);
H5E_BEGIN_TRY {
H5Sclose(sid);
@@ -673,7 +673,7 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -718,7 +718,7 @@ herr_t H5DSdetach_scale(hid_t did,
((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
len = --buf[idx].len;
if(len == 0) {
- free(buf[idx].p);
+ HDfree(buf[idx].p);
buf[idx].p = NULL;
}
/* Since a reference to a dim. scale can be inserted only once,
@@ -760,7 +760,7 @@ herr_t H5DSdetach_scale(hid_t did,
if(H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
@@ -786,7 +786,7 @@ herr_t H5DSdetach_scale(hid_t did,
if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
- dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t));
+ dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
if(dsbuf == NULL)
goto out;
@@ -876,7 +876,7 @@ herr_t H5DSdetach_scale(hid_t did,
if (H5Tclose(ntid) < 0)
goto out;
- free(dsbuf);
+ HDfree(dsbuf);
dsbuf = NULL;
return SUCCEED;
@@ -890,7 +890,7 @@ out:
H5Tclose(tid);
if(dsbuf) {
- free(dsbuf);
+ HDfree(dsbuf);
dsbuf = NULL;
}
if(buf) {
@@ -898,9 +898,9 @@ out:
free the pointers allocated when we read data in */
for(i = 0; i < rank; i++) {
if(buf[i].p)
- free(buf[i].p);
+ HDfree(buf[i].p);
}
- free(buf);
+ HDfree(buf);
buf = NULL;
}
} H5E_END_TRY;
@@ -1033,7 +1033,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -1079,7 +1079,7 @@ htri_t H5DSis_attached(hid_t did,
goto out;
if (H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
} /* has_dimlist */
@@ -1116,7 +1116,7 @@ htri_t H5DSis_attached(hid_t did,
if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0)
goto out;
- dsbuf = (ds_list_t*) malloc((size_t)nelmts * sizeof(ds_list_t));
+ dsbuf = (ds_list_t*) HDmalloc((size_t)nelmts * sizeof(ds_list_t));
if (dsbuf == NULL)
goto out;
@@ -1170,7 +1170,7 @@ htri_t H5DSis_attached(hid_t did,
if (H5Aclose(aid) < 0)
goto out;
- free(dsbuf);
+ HDfree(dsbuf);
dsbuf = NULL;
} /* has_reflist */
@@ -1189,11 +1189,11 @@ out:
} H5E_END_TRY;
if (buf) {
- free(buf);
+ HDfree(buf);
buf = NULL;
}
if(dsbuf) {
- free(dsbuf);
+ HDfree(dsbuf);
dsbuf = NULL;
}
return FAIL;
@@ -1317,7 +1317,7 @@ herr_t H5DSiterate_scales(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t*)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -1380,7 +1380,7 @@ herr_t H5DSiterate_scales(hid_t did,
if (H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
} /* if has_dimlist */
@@ -1390,7 +1390,7 @@ out:
H5E_BEGIN_TRY {
if(buf) {
H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
- free(buf);
+ HDfree(buf);
}
H5Sclose(sid);
H5Aclose(aid);
@@ -1489,7 +1489,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- buf = (const char **) malloc((size_t) rank * sizeof(char *));
+ buf = (const char **) HDmalloc((size_t) rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1513,7 +1513,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (buf)
{
- free(buf);
+ HDfree(buf);
buf = NULL;
}
}
@@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
/* allocate and initialize */
- buf = (const char **) malloc((size_t) rank * sizeof(char *));
+ buf = (const char **) HDmalloc((size_t) rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1543,7 +1543,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
/* free the ptr that will be replaced by label */
if (buf[idx])
- free((void *)buf[idx]);
+ HDfree((void *)buf[idx]);
/* store the label information in the required index */
buf[idx] = label;
@@ -1559,7 +1559,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
for (i = 0; i < (unsigned int) rank; i++)
{
if (buf[i])
- free((void *)buf[i]);
+ HDfree((void *)buf[i]);
}
/* close */
@@ -1569,7 +1569,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
if (buf)
{
- free(buf);
+ HDfree(buf);
buf = NULL;
}
}
@@ -1586,9 +1586,9 @@ out:
for (i = 0; i < (unsigned int) rank; i++)
{
if (buf[i])
- free((void *)buf[i]);
+ HDfree((void *)buf[i]);
}
- free(buf);
+ HDfree(buf);
}
H5E_BEGIN_TRY
{
@@ -1692,7 +1692,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
goto out;
/* allocate and initialize */
- buf = (char **) malloc((size_t) rank * sizeof(char *));
+ buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
if (buf == NULL)
goto out;
@@ -1724,7 +1724,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
for (i = 0; i < rank; i++)
{
if (buf[i])
- free(buf[i]);
+ HDfree(buf[i]);
}
/* close */
@@ -1734,7 +1734,7 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
goto out;
if (buf)
{
- free(buf);
+ HDfree(buf);
buf = NULL;
}
@@ -1748,9 +1748,9 @@ out:
for (i = 0; i < rank; i++)
{
if (buf[i])
- free(buf[i]);
+ HDfree(buf[i]);
}
- free(buf);
+ HDfree(buf);
}
H5E_BEGIN_TRY
{
@@ -1845,7 +1845,7 @@ ssize_t H5DSget_scale_name(hid_t did,
goto out;
/* allocate a temporary buffer */
- buf = (char*)malloc(nbytes * sizeof(char));
+ buf = (char*)HDmalloc(nbytes * sizeof(char));
if (buf == NULL)
goto out;
@@ -1872,7 +1872,7 @@ ssize_t H5DSget_scale_name(hid_t did,
if (H5Sclose(sid) < 0)
goto out;
if (buf)
- free(buf);
+ HDfree(buf);
return (ssize_t)(nbytes - 1);
@@ -1884,7 +1884,7 @@ out:
H5Sclose(sid);
} H5E_END_TRY;
if (buf)
- free(buf);
+ HDfree(buf);
return FAIL;
}
@@ -2052,7 +2052,7 @@ int H5DSget_num_scales(hid_t did,
goto out;
/* allocate and initialize the VL */
- buf = (hvl_t *)malloc((size_t)rank * sizeof(hvl_t));
+ buf = (hvl_t *)HDmalloc((size_t)rank * sizeof(hvl_t));
if(buf == NULL)
goto out;
@@ -2071,7 +2071,7 @@ int H5DSget_num_scales(hid_t did,
goto out;
if(H5Aclose(aid) < 0)
goto out;
- free(buf);
+ HDfree(buf);
buf = NULL;
} /* has_dimlist */
@@ -2086,7 +2086,7 @@ out:
} H5E_END_TRY;
if(buf)
- free(buf);
+ HDfree(buf);
return FAIL;
}
diff --git a/hl/src/H5HLprivate2.h b/hl/src/H5HLprivate2.h
index e2597db..1b67c70 100644
--- a/hl/src/H5HLprivate2.h
+++ b/hl/src/H5HLprivate2.h
@@ -22,44 +22,8 @@
/* Public High-Level header */
#include "hdf5_hl.h"
-/* The following is copied from src/H5private.h */
-
-/*
- * Status return values for the `herr_t' type.
- * Since some unix/c routines use 0 and -1 (or more precisely, non-negative
- * vs. negative) as their return code, and some assumption had been made in
- * the code about that, it is important to keep these constants the same
- * values. When checking the success or failure of an integer-valued
- * function, remember to compare against zero and not one of these two
- * values.
- */
-#define SUCCEED 0
-#define FAIL (-1)
-#define UFAIL (unsigned)(-1)
-
-/* minimum of two, three, or four values */
-#undef MIN
-#define MIN(a,b) (((a)<(b)) ? (a) : (b))
-#define MIN2(a,b) MIN(a,b)
-#define MIN3(a,b,c) MIN(a,MIN(b,c))
-#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
-
-/* maximum of two, three, or four values */
-#undef MAX
-#define MAX(a,b) (((a)>(b)) ? (a) : (b))
-#define MAX2(a,b) MAX(a,b)
-#define MAX3(a,b,c) MAX(a,MAX(b,c))
-#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
-
-/*
- * HDF Boolean type.
- */
-#ifndef FALSE
-# define FALSE 0
-#endif
-#ifndef TRUE
-# define TRUE 1
-#endif
+/* HDF5 private functions */
+#include "H5private.h"
#endif /* _H5HLprivate2_H */
diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c
index e55aaf8..9c7c7e8 100644
--- a/hl/src/H5IM.c
+++ b/hl/src/H5IM.c
@@ -594,7 +594,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
dim_ref = n_refs + 1;
- refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref );
+ refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( aid, atid, refbuf ) < 0)
goto out;
@@ -635,7 +635,7 @@ herr_t H5IMlink_palette( hid_t loc_id,
if(H5Aclose(aid) < 0)
goto out;
- free( refbuf );
+ HDfree( refbuf );
} /* ok_pal == 1 */
@@ -901,7 +901,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
dim_ref = n_refs;
- refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref );
+ refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( aid, atid, refbuf ) < 0)
goto out;
@@ -930,7 +930,7 @@ herr_t H5IMget_palette_info( hid_t loc_id,
goto out;
if ( H5Aclose( aid ) < 0)
goto out;
- free( refbuf );
+ HDfree( refbuf );
}
@@ -1012,7 +1012,7 @@ herr_t H5IMget_palette( hid_t loc_id,
dim_ref = n_refs;
- refbuf = (hobj_ref_t*)malloc( sizeof(hobj_ref_t) * (int)dim_ref );
+ refbuf = (hobj_ref_t*)HDmalloc( sizeof(hobj_ref_t) * (int)dim_ref );
if ( H5Aread( aid, atid, refbuf ) < 0)
goto out;
@@ -1034,7 +1034,7 @@ herr_t H5IMget_palette( hid_t loc_id,
goto out;
if ( H5Aclose( aid ) < 0)
goto out;
- free( refbuf );
+ HDfree( refbuf );
}
/* Close the image dataset. */
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 98f2ff2..d175099 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -13,13 +13,12 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <string.h>
-#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "H5LTprivate.h"
-#include "H5private.h"
/* For Lex and Yacc */
#define COL 3
diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c
index 92b041a..071ae20 100644
--- a/hl/src/H5PT.c
+++ b/hl/src/H5PT.c
@@ -13,9 +13,12 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#include <stdlib.h>
+
#include "H5PTprivate.h"
#include "H5TBprivate.h"
-#include <stdlib.h>
+
+#define HDfree(X) free(X)
/* Packet Table private data */
@@ -33,6 +36,7 @@ static H5I_type_t H5PT_ptable_id_type = H5I_UNINIT;
#define H5PT_HASH_TABLE_SIZE 64
/* Packet Table private functions */
+static herr_t H5PT_free_id(void *id);
static herr_t H5PT_close( htbl_t* table );
static herr_t H5PT_create_index(htbl_t *table_id);
static herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index);
@@ -84,11 +88,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if(H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
goto out;
/* Get memory for the table identifier */
- table = (htbl_t *)malloc(sizeof(htbl_t));
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
/* Create a simple data space with unlimited size */
dims[0] = 0;
@@ -142,7 +146,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id,
H5Pclose(plist_id);
H5Dclose(dset_id);
if(table)
- free(table);
+ HDfree(table);
H5E_END_TRY
return H5I_INVALID_HID;
}
@@ -232,10 +236,10 @@ hid_t H5PTopen( hid_t loc_id,
/* Register the packet table ID type if this is the first table created */
if( H5PT_ptable_id_type < 0)
- if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)free)) < 0)
+ if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0)
goto out;
- table = (htbl_t *)malloc(sizeof(htbl_t));
+ table = (htbl_t *)HDmalloc(sizeof(htbl_t));
if ( table == NULL ) {
goto out;
@@ -291,12 +295,26 @@ out:
{
H5Dclose(table->dset_id);
H5Tclose(table->type_id);
- free(table);
+ HDfree(table);
}
H5E_END_TRY
return H5I_INVALID_HID;
}
+/*-------------------------------------------------------------------------
+ * Function: H5PT_free_id
+ *
+ * Purpose: Free an id. Callback for H5Iregister_type.
+ *
+ * Return: Success: 0, Failure: N/A
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5PT_free_id(void *id)
+{
+ HDfree(id);
+ return 0;
+}
/*-------------------------------------------------------------------------
* Function: H5PT_close
@@ -331,7 +349,7 @@ H5PT_close( htbl_t* table)
if(H5Tclose(table->type_id) < 0)
goto out;
- free(table);
+ HDfree(table);
return 0;
@@ -342,7 +360,7 @@ out:
H5Dclose(table->dset_id);
H5Tclose(table->type_id);
H5E_END_TRY
- free(table);
+ HDfree(table);
}
return -1;
}
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index 0b6305b..1547e00 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>
-#include "H5private.h"
+
#include "H5LTprivate.h"
#include "H5TBprivate.h"
@@ -196,7 +196,7 @@ herr_t H5TBmake_table( const char *table_title,
if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0)
goto out;
- free( member_name );
+ HDfree( member_name );
}
@@ -234,7 +234,7 @@ herr_t H5TBmake_table( const char *table_title,
if (H5Aclose(attr_id) < 0)
goto out;
- free(member_name);
+ HDfree(member_name);
}
/* terminate access to the data space. */
@@ -570,7 +570,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id,
goto out;
}
- free( member_name );
+ HDfree( member_name );
}
@@ -734,7 +734,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id,
if(H5Tclose( nmtype_id ) < 0)
goto out;
- free( member_name );
+ HDfree( member_name );
}
@@ -1059,7 +1059,7 @@ herr_t H5TBread_fields_name( hid_t loc_id,
goto out;
j++;
}
- free( member_name );
+ HDfree( member_name );
}
/* get the dataspace handle */
@@ -1221,7 +1221,7 @@ herr_t H5TBread_fields_index( hid_t loc_id,
if (H5Tclose( nmtype_id ) < 0)
goto out;
- free( member_name );
+ HDfree( member_name );
}
/* get the dataspace handle */
@@ -1328,9 +1328,9 @@ herr_t H5TBdelete_record( hid_t loc_id,
if (H5TBget_table_info ( loc_id, dset_name, &nfields, &ntotal_records ) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
- if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -1351,7 +1351,7 @@ herr_t H5TBdelete_record( hid_t loc_id,
if ( read_nrecords )
{
- if(NULL == (tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, src_size )))
+ if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, src_size )))
goto out;
/* read the records after the deleted one(s) */
@@ -1415,22 +1415,22 @@ herr_t H5TBdelete_record( hid_t loc_id,
goto out;
if(tmp_buf)
- free(tmp_buf);
+ HDfree(tmp_buf);
if(src_offset)
- free(src_offset);
+ HDfree(src_offset);
if(src_sizes)
- free(src_sizes);
+ HDfree(src_sizes);
return 0;
/* error zone */
out:
if(tmp_buf)
- free(tmp_buf);
+ HDfree(tmp_buf);
if(src_offset)
- free(src_offset);
+ HDfree(src_offset);
if(src_sizes)
- free(src_sizes);
+ HDfree(src_sizes);
H5E_BEGIN_TRY
{
H5Tclose(mem_type_id);
@@ -1509,7 +1509,7 @@ herr_t H5TBinsert_record( hid_t loc_id,
goto out;
read_nrecords = ntotal_records - start;
- tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, type_size);
+ tmp_buf = (unsigned char *)HDcalloc((size_t) read_nrecords, type_size);
/* read the records after the inserted one(s) */
if (H5TBread_records( loc_id, dset_name, start, read_nrecords, type_size, field_offset, field_sizes, tmp_buf ) < 0)
@@ -1585,7 +1585,7 @@ herr_t H5TBinsert_record( hid_t loc_id,
if (H5Dclose( did ) < 0)
return -1;
- free( tmp_buf );
+ HDfree( tmp_buf );
return 0;
@@ -1652,9 +1652,9 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (H5TBget_table_info ( loc_id, dset_name1, &nfields, &ntotal_records ) < 0)
goto out;
- if(NULL == (src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ if(NULL == (src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
- if(NULL == (src_sizes = (size_t *)malloc((size_t)nfields * sizeof(size_t))))
+ if(NULL == (src_sizes = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t))))
goto out;
/* get field info */
@@ -1682,7 +1682,7 @@ herr_t H5TBadd_records_from( hid_t loc_id,
if (( type_size1 = H5Tget_size( tid_1 )) == 0 )
goto out;
- if(NULL == (tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 )))
+ if(NULL == (tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, type_size1 )))
goto out;
/* define a hyperslab in the dataset of the size of the records */
@@ -1721,22 +1721,22 @@ herr_t H5TBadd_records_from( hid_t loc_id,
goto out;
if(tmp_buf)
- free(tmp_buf);
+ HDfree(tmp_buf);
if(src_offset)
- free(src_offset);
+ HDfree(src_offset);
if(src_sizes)
- free(src_sizes);
+ HDfree(src_sizes);
return 0;
/* error zone */
out:
if(tmp_buf)
- free(tmp_buf);
+ HDfree(tmp_buf);
if(src_offset)
- free(src_offset);
+ HDfree(src_offset);
if(src_sizes)
- free(src_sizes);
+ HDfree(src_sizes);
H5E_BEGIN_TRY
{
H5Dclose(did_1);
@@ -1998,7 +1998,7 @@ herr_t H5TBcombine_tables(hid_t loc_id1,
did_1 = H5I_BADID;
/* Release resources. */
- free(tmp_buf);
+ HDfree(tmp_buf);
tmp_buf = NULL;
/*-------------------------------------------------------------------------
@@ -2100,13 +2100,13 @@ herr_t H5TBcombine_tables(hid_t loc_id1,
out:
if(tmp_buf)
- free(tmp_buf);
+ HDfree(tmp_buf);
if(tmp_fill_buf)
- free(tmp_fill_buf);
+ HDfree(tmp_fill_buf);
if(src_offset)
- free(src_offset);
+ HDfree(src_offset);
if(src_sizes)
- free(src_sizes);
+ HDfree(src_sizes);
H5E_BEGIN_TRY {
if(member_type_id > 0)
@@ -2254,7 +2254,7 @@ herr_t H5TBinsert_field( hid_t loc_id,
goto out;
/* alloc fill value attribute buffer */
- tmp_fill_buf = (unsigned char *)malloc(total_size );
+ tmp_fill_buf = (unsigned char *)HDmalloc(total_size );
/* get the fill value attributes */
if ((H5TBAget_fill( loc_id, dset_name, did_1, tmp_fill_buf )) < 0)
@@ -2314,7 +2314,7 @@ herr_t H5TBinsert_field( hid_t loc_id,
curr_offset += member_size;
- free( member_name );
+ HDfree( member_name );
/* close the member type */
if(H5Tclose( member_type_id ) < 0)
@@ -2349,7 +2349,7 @@ herr_t H5TBinsert_field( hid_t loc_id,
*-------------------------------------------------------------------------
*/
- tmp_buf = (unsigned char *)calloc((size_t)nrecords, (size_t)total_size);
+ tmp_buf = (unsigned char *)HDcalloc((size_t)nrecords, (size_t)total_size);
/* define a hyperslab in the dataset of the size of the records */
offset[0] = 0;
@@ -2557,8 +2557,8 @@ herr_t H5TBinsert_field( hid_t loc_id,
goto out;
/* release resources. */
- free ( tmp_buf );
- free ( tmp_fill_buf );
+ HDfree ( tmp_buf );
+ HDfree ( tmp_fill_buf );
return 0;
@@ -2694,13 +2694,13 @@ herr_t H5TBdelete_field( hid_t loc_id,
if (H5Tclose( member_type_id ) < 0)
goto out;
- free( member_name );
+ HDfree( member_name );
break;
}
- free( member_name );
+ HDfree( member_name );
} /* i */
@@ -2722,7 +2722,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
curr_offset = 0;
/* alloc fill value attribute buffer */
- tmp_fill_buf = (unsigned char *)malloc((size_t) type_size2 );
+ tmp_fill_buf = (unsigned char *)HDmalloc((size_t) type_size2 );
/*-------------------------------------------------------------------------
* get attributes from previous table in the process
@@ -2742,7 +2742,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
/* we want to skip the field to delete */
if (H5TB_find_field( member_name, field_name ) > 0 )
{
- free( member_name );
+ HDfree( member_name );
continue;
}
@@ -2780,7 +2780,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
curr_offset += member_size;
- free(member_name);
+ HDfree(member_name);
/* close the member type */
if (H5Tclose(member_type_id) < 0)
@@ -2821,7 +2821,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
/* skip the field to delete */
if (H5TB_find_field(member_name, field_name) > 0)
{
- free(member_name);
+ HDfree(member_name);
continue;
}
@@ -2840,7 +2840,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
if (H5Tinsert( read_type_id, member_name, (size_t)0, member_type_id ) < 0)
goto out;
- tmp_buf = (unsigned char *)calloc((size_t) nrecords, member_size );
+ tmp_buf = (unsigned char *)HDcalloc((size_t) nrecords, member_size );
/* read */
if (H5Dread( did_1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0)
@@ -2881,8 +2881,8 @@ herr_t H5TBdelete_field( hid_t loc_id,
goto out;
/* release resources. */
- free( member_name );
- free ( tmp_buf );
+ HDfree( member_name );
+ HDfree ( tmp_buf );
} /* i */
@@ -3007,7 +3007,7 @@ herr_t H5TBdelete_field( hid_t loc_id,
goto out;
/* Release resources. */
- free ( tmp_fill_buf );
+ HDfree ( tmp_fill_buf );
return 0;
@@ -3101,7 +3101,7 @@ htri_t H5TBAget_fill(hid_t loc_id,
if (H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0)
return -1;
- src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t));
+ src_offset = (size_t *)HDmalloc((size_t)nfields * sizeof(size_t));
if (src_offset == NULL )
return -1;
@@ -3130,12 +3130,12 @@ htri_t H5TBAget_fill(hid_t loc_id,
}
- free( src_offset );
+ HDfree( src_offset );
return has_fill;
out:
- free( src_offset );
+ HDfree( src_offset );
return -1;
}
@@ -3306,7 +3306,7 @@ herr_t H5TBget_field_info( hid_t loc_id,
member_name = H5Tget_member_name(tid, (unsigned)i);
strcpy(field_names[i], member_name);
- free(member_name);
+ HDfree(member_name);
} /* end if */
/* get the member type */
@@ -3459,7 +3459,7 @@ herr_t H5TB_attach_attributes( const char *table_title,
if (H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0)
goto out;
- free( member_name );
+ HDfree( member_name );
}
@@ -3508,14 +3508,14 @@ hid_t H5TB_create_type(hid_t loc_id,
if (H5TBget_table_info(loc_id,dset_name,&nfields,NULL) < 0)
return -1;
- if ((fnames = (char**) malloc(sizeof(char*)*(size_t)nfields))==NULL)
+ if ((fnames = (char**) HDmalloc(sizeof(char*)*(size_t)nfields))==NULL)
return -1;
for ( i = 0; i < nfields; i++)
{
- if ((fnames[i] = (char*) malloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL)
+ if ((fnames[i] = (char*) HDmalloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL)
{
- free(fnames);
+ HDfree(fnames);
return -1;
}
}
@@ -3551,9 +3551,9 @@ hid_t H5TB_create_type(hid_t loc_id,
for ( i=0; i<nfields; i++)
{
- free (fnames[i]);
+ HDfree (fnames[i]);
}
- free (fnames);
+ HDfree (fnames);
return mem_type_id;
@@ -3567,10 +3567,10 @@ out:
for ( i=0; i<nfields; i++)
{
if (fnames[i])
- free (fnames[i]);
+ HDfree (fnames[i]);
}
if (fnames)
- free (fnames);
+ HDfree (fnames);
return -1;
}
diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h
index 4643932..e9e3bf1 100644
--- a/hl/src/hdf5_hl.h
+++ b/hl/src/hdf5_hl.h
@@ -27,7 +27,7 @@
#include "H5LTpublic.h" /* lite */
#include "H5IMpublic.h" /* image */
#include "H5TBpublic.h" /* table */
-#include "H5PTpublic.h" /* table */
+#include "H5PTpublic.h" /* packet table */
#endif /*H5_INCLUDE_HL*/
diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c
index a60a560..2fc8140 100644
--- a/hl/test/gen_test_ds.c
+++ b/hl/test/gen_test_ds.c
@@ -255,13 +255,13 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 1) {
if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
- name_out = (char*)malloc((size_t)name_len * sizeof (char));
+ name_out = (char*)HDmalloc((size_t)name_len * sizeof (char));
if(name_out != NULL) {
if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) {
if(strcmp(scalename,name_out)==0) {
ret_value = SUCCEED;
}
- free(name_out);
+ HDfree(name_out);
name_out=NULL;
}
}
diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c
index 9a0ffb0..08d1c46 100644
--- a/hl/test/test_dset_opt.c
+++ b/hl/test/test_dset_opt.c
@@ -176,7 +176,7 @@ test_direct_chunk_write (hid_t file)
direct_buf[i][j] = n++;
/* Allocate output (compressed) buffer */
- outbuf = malloc(z_dst_nbytes);
+ outbuf = HDmalloc(z_dst_nbytes);
z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
@@ -206,7 +206,7 @@ test_direct_chunk_write (hid_t file)
}
if(outbuf)
- free(outbuf);
+ HDfree(outbuf);
if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
@@ -249,7 +249,7 @@ test_direct_chunk_write (hid_t file)
direct_buf[i][j] = i + j;
/* Allocate output (compressed) buffer */
- outbuf = malloc(z_dst_nbytes);
+ outbuf = HDmalloc(z_dst_nbytes);
z_dst = (Bytef *)outbuf;
/* Perform compression from the source to the destination buffer */
@@ -280,7 +280,7 @@ test_direct_chunk_write (hid_t file)
}
if(outbuf)
- free(outbuf);
+ HDfree(outbuf);
if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
@@ -329,7 +329,7 @@ error:
} H5E_END_TRY;
if(outbuf)
- free(outbuf);
+ HDfree(outbuf);
return 1;
}
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index 9729421..831fa23 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -77,23 +77,23 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags)
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array of pointers for each of the open images */
- if (NULL == (buf_ptr = (void **)malloc(sizeof(void *) * open_images)))
+ if (NULL == (buf_ptr = (void **)HDmalloc(sizeof(void *) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the name of each of the open images */
- if (NULL == (filename = (char **)malloc(sizeof(char *) * open_images)))
+ if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the size of each of the open images */
- if (NULL == (buf_size = (ssize_t *)malloc(sizeof(ssize_t) * open_images)))
+ if (NULL == (buf_size = (ssize_t *)HDmalloc(sizeof(ssize_t) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array for each of the file identifiers */
- if (NULL == (file_id = (hid_t *)malloc(sizeof(hid_t) * open_images)))
+ if (NULL == (file_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array for each of the dataset identifiers */
- if (NULL == (dset_id = (hid_t *)malloc(sizeof(hid_t) * open_images)))
+ if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
TESTING("get file images");
diff --git a/test/accum.c b/test/accum.c
index 488b866..e981b38 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1661,9 +1661,9 @@ test_random_write(void)
unsigned u; /* Local index variable */
/* Allocate space for the write & read buffers */
- wbuf = (uint8_t *)malloc(RANDOM_BUF_SIZE);
+ wbuf = (uint8_t *)HDmalloc(RANDOM_BUF_SIZE);
HDassert(wbuf);
- rbuf = (uint8_t *)calloc(RANDOM_BUF_SIZE, 1);
+ rbuf = (uint8_t *)HDcalloc(RANDOM_BUF_SIZE, 1);
HDassert(rbuf);
/* Initialize write buffer */
@@ -1681,9 +1681,9 @@ HDfprintf(stderr, "Random # seed was: %u\n", seed);
HDsrandom(seed);
/* Allocate space for the segment length buffer */
- off = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
+ off = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
HDassert(off);
- len = (size_t *)malloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
+ len = (size_t *)HDmalloc(MAX_RANDOM_SEGMENTS * sizeof(size_t));
HDassert(len);
/* Randomly choose lengths of segments */
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index 433c488..b3d17dc 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -614,7 +614,7 @@ test_compound (char *filename, hid_t fapl)
if ((s8_m_sid = H5Screate_simple (2, h_size, NULL)) < 0) goto error;
/* Read the dataset */
- s8 = (s1_t *) calloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t));
+ s8 = (s1_t *) HDcalloc ((size_t)(h_size[0]*h_size[1]), sizeof(s1_t));
assert (s8);
if (H5Dread (dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) {
goto error;
@@ -641,7 +641,7 @@ test_compound (char *filename, hid_t fapl)
}
}
- free (s8);
+ HDfree (s8);
s8 = NULL;
PASSED();
@@ -781,7 +781,7 @@ test_compound (char *filename, hid_t fapl)
f_offset[1] = NY/3;
h_size[0] = 2*NX/3 - f_offset[0];
h_size[1] = 2*NY/3 - f_offset[1];
- s11 = (s4_t *) malloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t));
+ s11 = (s4_t *) HDmalloc ((size_t)h_size[0]*(size_t)h_size[1]*sizeof(s4_t));
assert (s11);
/* Initialize */
@@ -793,7 +793,7 @@ test_compound (char *filename, hid_t fapl)
if (H5Dwrite (dataset, s4_tid, s8_m_sid, s8_f_sid, PRESERVE, s11) < 0) {
goto error;
}
- free (s11);
+ HDfree (s11);
s11=NULL;
/* Read the whole thing */
@@ -1380,12 +1380,12 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
goto error;
/* Allocate space and initialize data */
- orig = (unsigned char*)malloc(NX * NY * sizeof(stype1));
+ orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1));
initialize_stype1(orig, (size_t)NX*NY);
- rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype2));
+ rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2));
- rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype3));
+ rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype3));
initialize_stype3(rew_buf, (size_t)NX*NY);
@@ -1515,9 +1515,9 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- free(orig);
- free(rbuf);
- free(rew_buf);
+ HDfree(orig);
+ HDfree(rbuf);
+ HDfree(rew_buf);
PASSED();
return 0;
@@ -1585,12 +1585,12 @@ test_hdf5_dst_subset(char *filename, hid_t fapl)
goto error;
/* Allocate space and initialize data */
- orig = (unsigned char*)malloc(NX * NY * sizeof(stype2));
+ orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2));
initialize_stype2(orig, (size_t)NX*NY);
- rbuf = (unsigned char*)malloc(NX * NY * sizeof(stype1));
+ rbuf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1));
- rew_buf = (unsigned char*)malloc(NX * NY * sizeof(stype4));
+ rew_buf = (unsigned char*)HDmalloc(NX * NY * sizeof(stype4));
initialize_stype4(rew_buf, (size_t)NX*NY);
/* Create dataset creation property list */
@@ -1719,9 +1719,9 @@ test_hdf5_dst_subset(char *filename, hid_t fapl)
if(H5Fclose(file) < 0)
goto error;
- free(orig);
- free(rbuf);
- free(rew_buf);
+ HDfree(orig);
+ HDfree(rbuf);
+ HDfree(rew_buf);
PASSED();
return 0;
diff --git a/test/dsets.c b/test/dsets.c
index cec8f9a..a8163be 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -477,7 +477,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
HDclose(f);
- free (tconv_buf);
+ HDfree (tconv_buf);
PASSED();
} /* end if */
else {
@@ -1848,13 +1848,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
if(H5Dclose (dataset) < 0) goto error;
if(H5Sclose (sid) < 0) goto error;
if(H5Pclose (dxpl) < 0) goto error;
- free (tconv_buf);
+ HDfree (tconv_buf);
return(0);
error:
if(tconv_buf)
- free (tconv_buf);
+ HDfree (tconv_buf);
return -1;
}
@@ -6533,7 +6533,7 @@ auxread_fdata(hid_t fid, const char *name)
if(H5Dclose(dset_id) < 0)
goto error;
if(buf)
- free(buf);
+ HDfree(buf);
return 0;
@@ -6545,7 +6545,7 @@ error:
H5Tclose(ftype_id);
H5Tclose(mtype_id);
if(buf)
- free(buf);
+ HDfree(buf);
} H5E_END_TRY;
return -1;
}
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 9f003a6..c3692d0 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -296,8 +296,8 @@ static int without_hardware_g = 0;
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
\
- tmp1 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
- tmp2 = (unsigned char*)calloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp1 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
+ tmp2 = (unsigned char*)HDcalloc((size_t)1, (size_t)SRC_SIZE); \
\
buf_p = BUF; \
saved_p = SAVED; \
@@ -325,8 +325,8 @@ static int without_hardware_g = 0;
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
} \
- free(tmp1); \
- free(tmp2); \
+ HDfree(tmp1); \
+ HDfree(tmp2); \
}
/* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity,
@@ -348,7 +348,7 @@ static int without_hardware_g = 0;
SAVED = (unsigned char*)aligned_malloc( NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(BUF, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
HDmemset(SAVED, 0, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- value = (unsigned char*)calloc(SRC_SIZE, sizeof(unsigned char)); \
+ value = (unsigned char*)HDcalloc(SRC_SIZE, sizeof(unsigned char)); \
\
buf_p = BUF; \
\
@@ -391,7 +391,7 @@ static int without_hardware_g = 0;
} \
\
HDmemcpy(SAVED, BUF, NELMTS*MAX(SRC_SIZE, DST_SIZE)); \
- free(value); \
+ HDfree(value); \
}
void some_dummy_func(float x);
@@ -751,8 +751,8 @@ static int test_particular_fp_integer(void)
endian = H5Tget_order(H5T_NATIVE_DOUBLE);
src_size1 = H5Tget_size(H5T_NATIVE_DOUBLE);
dst_size1 = H5Tget_size(H5T_NATIVE_SCHAR);
- buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
- saved_buf1 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
+ saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1));
memcpy(buf1, &src_d, src_size1);
memcpy(saved_buf1, &src_d, src_size1);
@@ -801,8 +801,8 @@ static int test_particular_fp_integer(void)
/* Test conversion from float (the value is INT_MAX) to int. */
src_size2 = H5Tget_size(H5T_NATIVE_FLOAT);
dst_size2 = H5Tget_size(H5T_NATIVE_INT);
- buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
- saved_buf2 = (unsigned char*)calloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
+ saved_buf2 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size2, dst_size2));
HDmemcpy(buf2, &src_f, src_size2);
HDmemcpy(saved_buf2, &src_f, src_size2);
@@ -852,13 +852,13 @@ static int test_particular_fp_integer(void)
}
if(buf1)
- free(buf1);
+ HDfree(buf1);
if(buf2)
- free(buf2);
+ HDfree(buf2);
if(saved_buf1)
- free(saved_buf1);
+ HDfree(saved_buf1);
if(saved_buf2)
- free(saved_buf2);
+ HDfree(saved_buf2);
PASSED();
return 0;
@@ -869,13 +869,13 @@ error:
H5Pclose(dxpl_id);
} H5E_END_TRY;
if(buf1)
- free(buf1);
+ HDfree(buf1);
if(buf2)
- free(buf2);
+ HDfree(buf2);
if(saved_buf1)
- free(saved_buf1);
+ HDfree(saved_buf1);
if(saved_buf2)
- free(saved_buf2);
+ HDfree(saved_buf2);
reset_hdf5(); /*print statistics*/
return MAX((int)fails_this_test, 1);
@@ -1044,11 +1044,11 @@ test_derived_flt(void)
*/
src_size = H5Tget_size(H5T_NATIVE_INT);
endian = H5Tget_order(H5T_NATIVE_INT);
- buf = (unsigned char*)malloc(nelmts * (MAX(src_size, size)));
- saved_buf = (unsigned char*)malloc(nelmts * src_size);
+ buf = (unsigned char*)HDmalloc(nelmts * (MAX(src_size, size)));
+ saved_buf = (unsigned char*)HDmalloc(nelmts * src_size);
HDmemset(buf, 0, nelmts * MAX(src_size, size));
HDmemset(saved_buf, 0, nelmts * src_size);
- aligned = (int*)calloc((size_t)1, src_size);
+ aligned = (int*)HDcalloc((size_t)1, src_size);
for(i = 0; i < nelmts * src_size; i++)
buf[i] = saved_buf[i] = HDrand();
@@ -1105,9 +1105,9 @@ test_derived_flt(void)
}
fails_this_test = 0;
- free(buf);
- free(saved_buf);
- free(aligned);
+ HDfree(buf);
+ HDfree(saved_buf);
+ HDfree(aligned);
buf = NULL;
saved_buf = NULL;
aligned = NULL;
@@ -1204,8 +1204,8 @@ test_derived_flt(void)
src_size = H5Tget_size(tid2);
dst_size = H5Tget_size(tid1);
endian = H5Tget_order(tid2);
- buf = (unsigned char*)malloc(nelmts*(MAX(src_size, dst_size)));
- saved_buf = (unsigned char*)malloc(nelmts*src_size);
+ buf = (unsigned char*)HDmalloc(nelmts*(MAX(src_size, dst_size)));
+ saved_buf = (unsigned char*)HDmalloc(nelmts*src_size);
HDmemset(buf, 0, nelmts*MAX(src_size, dst_size));
HDmemset(saved_buf, 0, nelmts*src_size);
@@ -1268,8 +1268,8 @@ test_derived_flt(void)
}
}
- if (buf) free(buf);
- if (saved_buf) free(saved_buf);
+ if (buf) HDfree(buf);
+ if (saved_buf) HDfree(saved_buf);
if(H5Tclose(tid1) < 0) {
H5_FAILED();
@@ -1301,9 +1301,9 @@ test_derived_flt(void)
return 0;
error:
- if (buf) free(buf);
- if (saved_buf) free(saved_buf);
- if (aligned) free(aligned);
+ if (buf) HDfree(buf);
+ if (saved_buf) HDfree(saved_buf);
+ if (aligned) HDfree(aligned);
HDfflush(stdout);
H5E_BEGIN_TRY {
H5Tclose (tid1);
@@ -1594,8 +1594,8 @@ test_derived_integer(void)
goto error;
} /* end if */
- free(buf);
- free(saved_buf);
+ HDfree(buf);
+ HDfree(saved_buf);
PASSED();
reset_hdf5(); /*print statistics*/
@@ -1603,8 +1603,8 @@ test_derived_integer(void)
return 0;
error:
- if (buf) free(buf);
- if (saved_buf) free(saved_buf);
+ if (buf) HDfree(buf);
+ if (saved_buf) HDfree(saved_buf);
HDfflush(stdout);
H5E_BEGIN_TRY {
H5Tclose (tid1);
@@ -2781,7 +2781,7 @@ my_isinf(int endian, unsigned char *val, size_t size,
int retval = 0;
size_t i;
- bits = (unsigned char*)calloc((size_t)1, size);
+ bits = (unsigned char*)HDcalloc((size_t)1, size);
#ifdef H5_VMS
if(H5T_ORDER_VAX==endian) {
@@ -2805,7 +2805,7 @@ my_isinf(int endian, unsigned char *val, size_t size,
H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0)
retval = 1;
- free(bits);
+ HDfree(bits);
return retval;
}
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;
diff --git a/test/h5test.c b/test/h5test.c
index 32d78bd..30a3adf 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -751,7 +751,7 @@ h5_set_info_object(void)
/* copy key/value pair into temporary buffer */
len = strcspn(valp, ";");
next = &valp[len];
- key_val = (char *)calloc(1, len + 1);
+ key_val = (char *)HDcalloc(1, len + 1);
/* increment the next pointer past the terminating semicolon */
if (*next == ';')
diff --git a/test/ntypes.c b/test/ntypes.c
index 0af3a3f..c52c08f 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2605,7 +2605,7 @@ test_bitfield_dtype(hid_t file)
if((ntype_size = H5Tget_size(native_type)) == 0) TEST_ERROR;
- rbuf = malloc((size_t)nelmts*ntype_size);
+ rbuf = HDmalloc((size_t)nelmts*ntype_size);
/* Read the data and compare them */
if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -2624,7 +2624,7 @@ test_bitfield_dtype(hid_t file)
if(H5Tclose(dtype) < 0) TEST_ERROR;
if(H5Tclose(native_type) < 0) TEST_ERROR;
if(H5Dclose(dataset1) < 0) TEST_ERROR;
- if(rbuf) free(rbuf);
+ if(rbuf) HDfree(rbuf);
/* Open dataset2 again to check H5Tget_native_type */
if((dataset2 = H5Dopen2(file, DSET2_BITFIELD_NAME, H5P_DEFAULT)) < 0) TEST_ERROR;
diff --git a/test/tarray.c b/test/tarray.c
index 299c74e..e3999bb 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);
+ HDfree(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);
+ HDfree(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);
+ HDfree(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);
+ HDfree(mname);
/* Check the 2nd field's offset */
off=H5Tget_member_offset(tid2,1);
@@ -1041,7 +1041,7 @@ test_array_vlen_atomic(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=malloc((i+j+1)*sizeof(unsigned int));
+ wdata[i][j].p=HDmalloc((i+j+1)*sizeof(unsigned int));
wdata[i][j].len=i+j+1;
for(k=0; k<(i+j+1); k++)
((unsigned int *)wdata[i][j].p)[k]=i*100+j*10+k;
@@ -1252,7 +1252,7 @@ test_array_vlen_array(void)
/* Initialize array data to write */
for(i=0; i<SPACE1_DIM1; i++)
for(j=0; j<ARRAY1_DIM1; j++) {
- wdata[i][j].p=malloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
+ wdata[i][j].p=HDmalloc((i+j+1)*(sizeof(unsigned int)*ARRAY1_DIM1));
wdata[i][j].len=i+j+1;
for(k=0; k<(i+j+1); k++)
for(l=0; l<ARRAY1_DIM1; l++)
@@ -1633,7 +1633,7 @@ test_array_bkg(void)
/* Release memory resources */
/* ------------------------ */
for (i = 0; i < dtsinfo.nsubfields; i++)
- free(dtsinfo.name[i]);
+ HDfree(dtsinfo.name[i]);
/* Release IDs */
@@ -1848,7 +1848,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);
+ HDfree(mname);
/* Check the 1st field's offset */
off=H5Tget_member_offset(tid1,0);
@@ -1867,7 +1867,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);
+ HDfree(mname);
/* Check the 2nd field's offset */
off=H5Tget_member_offset(tid1,1);
@@ -1886,7 +1886,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);
+ HDfree(mname);
/* Check the 3rd field's offset */
off=H5Tget_member_offset(tid1,2);
@@ -1930,7 +1930,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) HDfree(mname);
/* Check the 1st field's offset */
off=H5Tget_member_offset(tid1,0);
@@ -1949,7 +1949,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) HDfree(mname);
/* Check the 2nd field's offset */
off=H5Tget_member_offset(tid1,1);
@@ -1994,7 +1994,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) HDfree(mname);
/* Check the 3rd field's offset */
off=H5Tget_member_offset(tid1,2);
@@ -2039,7 +2039,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) HDfree(mname);
/* Check the 4th field's offset */
off=H5Tget_member_offset(tid1,3);
diff --git a/test/tattr.c b/test/tattr.c
index 1285f0e..a5a61bc 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);
+ HDfree(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..5f8d8f5 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);
+ HDfree(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);
+ HDfree(name);
/* Check class parent */
cid2 = H5Pget_class_parent(cid1);
@@ -1818,7 +1818,7 @@ test_genprop_path(void)
VERIFY(ret, 1, "H5Pequal");
/* Release the path string */
- free(path);
+ HDfree(path);
/* Close class */
ret = H5Pclose_class(cid3);
diff --git a/test/tid.c b/test/tid.c
index 87f3d37..4ea45db 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -81,13 +81,13 @@ static int basic_id_test(void)
/* Register an ID and retrieve the object it points to.
* Once the ID has been registered, testObj will be freed when
* its ID type is destroyed. */
- testObj = malloc(7 * sizeof(int));
+ testObj = HDmalloc(7 * sizeof(int));
arrayID = H5Iregister(myType, testObj);
CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
if(arrayID == H5I_INVALID_HID)
{
- free(testObj);
+ HDfree(testObj);
goto out;
}
@@ -175,13 +175,13 @@ static int basic_id_test(void)
* freed when the previous type was destroyed. Allocate new
* memory for it.
*/
- testObj = malloc(7 * sizeof(int));
+ testObj = HDmalloc(7 * sizeof(int));
arrayID = H5Iregister(myType, testObj);
CHECK(arrayID, H5I_INVALID_HID, "H5Iregister");
if(arrayID == H5I_INVALID_HID)
{
- free(testObj);
+ HDfree(testObj);
goto out;
}
@@ -250,7 +250,7 @@ static int id_predefined_test(void )
void * testPtr;
herr_t testErr;
- testObj = malloc(sizeof(int));
+ testObj = HDmalloc(sizeof(int));
/* Try to perform illegal functions on various predefined types */
H5E_BEGIN_TRY
@@ -319,14 +319,14 @@ static int id_predefined_test(void )
/* testObj was never registered as an atom, so it will not be
* automatically freed. */
- free(testObj);
+ HDfree(testObj);
return 0;
out:
if(typeID != H5I_INVALID_HID)
H5Tclose(typeID);
if(testObj != NULL)
- free(testObj);
+ HDfree(testObj);
return -1;
}
diff --git a/test/tmisc.c b/test/tmisc.c
index 6fcf557..512d029 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -1677,7 +1677,7 @@ test_misc8(void)
/* Free the read & write buffers */
HDfree(wdata);
#ifdef VERIFY_DATA
- free(rdata);
+ HDfree(rdata);
#endif /* VERIFY_DATA */
} /* end test_misc8() */
diff --git a/test/trefer.c b/test/trefer.c
index 9031fdb..698e95a 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -90,9 +90,9 @@ test_reference_params(void)
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -234,9 +234,9 @@ test_reference_params(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
- free(tbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
} /* test_reference_obj() */
/****************************************************************
@@ -271,9 +271,9 @@ test_reference_obj(void)
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)malloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -482,9 +482,9 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
- free(tbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
} /* test_reference_obj() */
/****************************************************************
@@ -763,10 +763,10 @@ test_reference_region(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
- free(dwbuf);
- free(drbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
} /* test_reference_region() */
/****************************************************************
@@ -1048,10 +1048,10 @@ test_reference_region_1D(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
- free(dwbuf);
- free(drbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
} /* test_reference_region_1D() */
/****************************************************************
diff --git a/test/tselect.c b/test/tselect.c
index 1041ab3..8ca3c24 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -354,8 +354,8 @@ test_select_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_hyper() */
struct pnt_iter {
@@ -637,8 +637,8 @@ test_select_point(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_point() */
/****************************************************************
@@ -750,8 +750,8 @@ test_select_all(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_all() */
/****************************************************************
@@ -890,8 +890,8 @@ test_select_all_hyper(hid_t xfer_plist)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_all_hyper() */
/****************************************************************
@@ -5406,8 +5406,8 @@ test_select_hyper_and_2d(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_hyper_and_2d() */
/****************************************************************
@@ -5537,8 +5537,8 @@ test_select_hyper_xor_2d(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_hyper_xor_2d() */
/****************************************************************
@@ -5667,8 +5667,8 @@ test_select_hyper_notb_2d(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_hyper_notb_2d() */
/****************************************************************
@@ -6440,8 +6440,8 @@ test_select_point_chunk(void)
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
- free(data);
- free (data_out);
+ HDfree(data);
+ HDfree (data_out);
} /* test_select_point_chunk() */
/****************************************************************
@@ -7620,8 +7620,8 @@ test_select_none(void)
CHECK(ret, FAIL, "H5Fclose");
/* Free memory buffers */
- free(wbuf);
- free(rbuf);
+ HDfree(wbuf);
+ HDfree(rbuf);
} /* test_select_none() */
/****************************************************************
diff --git a/test/tsohm.c b/test/tsohm.c
index eb5f7c5..8ebfd52 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -3884,7 +3884,7 @@ test_sohm_external_dtype(void)
CHECK_I(dset1_tid, "H5Dget_type");
/* Allocate space and initialize data */
- orig = (s1_t*)malloc(NX * NY * sizeof(s1_t));
+ orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t));
for(i=0; i<NX*NY; i++) {
s_ptr = (s1_t*)orig + i;
s_ptr->a = i*3 + 1;
@@ -3963,7 +3963,7 @@ test_sohm_external_dtype(void)
ret = H5Fclose(file2);
CHECK_I(ret, "H5Fclose");
- free(orig);
+ HDfree(orig);
}
diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c
index 0efd02c..dec2eee 100644
--- a/test/ttsafe_acreate.c
+++ b/test/ttsafe_acreate.c
@@ -113,7 +113,7 @@ void tts_acreate(void)
* with the dataset
*/
for(i = 0; i < NUM_THREADS; i++) {
- attrib_data = malloc(sizeof(ttsafe_name_data_t));
+ attrib_data = HDmalloc(sizeof(ttsafe_name_data_t));
attrib_data->dataset = dataset;
attrib_data->datatype = datatype;
attrib_data->dataspace = dataspace;
@@ -170,7 +170,7 @@ void *tts_acreate_thread(void *client_data)
H5P_DEFAULT, H5P_DEFAULT);
/* Write data to the attribute */
- attribute_data = malloc(sizeof(int));
+ attribute_data = HDmalloc(sizeof(int));
*attribute_data = attrib_data->current_index;
H5Awrite(attribute, H5T_NATIVE_INT, attribute_data);
H5Aclose(attribute);
diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c
index 8264403..56f431e 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -145,7 +145,7 @@ void *tts_cancel_thread(void UNUSED *arg)
assert(dataset >= 0);
/* If thread is cancelled, make cleanup call */
- cleanup_structure = (cancel_cleanup_t*)malloc(sizeof(cancel_cleanup_t));
+ cleanup_structure = (cancel_cleanup_t*)HDmalloc(sizeof(cancel_cleanup_t));
cleanup_structure->dataset = dataset;
cleanup_structure->datatype = datatype;
cleanup_structure->dataspace = dataspace;
@@ -156,7 +156,7 @@ void *tts_cancel_thread(void UNUSED *arg)
ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue);
assert(ret>=0);
- buffer = malloc(sizeof(int));
+ buffer = HDmalloc(sizeof(int));
ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
assert(ret>=0);
ret=H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset);
diff --git a/test/tunicode.c b/test/tunicode.c
index 0386352..7dfda16 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -605,7 +605,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);
+ HDfree(readbuf);
/* Add the other fields to the datatype */
ret = H5Tinsert(s1_tid, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE);
@@ -718,7 +718,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);
+ HDfree(read_buf);
ret = H5Tclose(type_id);
CHECK(ret, FAIL, "H5Tclose");
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index e45d24a..f51acd4 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -237,10 +237,10 @@ static void gent_named_vl(hid_t loc_id)
/* allocate and initialize VL dataset to write */
buf[0].len = 1;
- buf[0].p = malloc( 1 * sizeof(int));
+ buf[0].p = HDmalloc( 1 * sizeof(int));
((int *)buf[0].p)[0]=1;
buf[1].len = 2;
- buf[1].p = malloc( 2 * sizeof(int));
+ buf[1].p = HDmalloc( 2 * sizeof(int));
((int *)buf[1].p)[0]=2;
((int *)buf[1].p)[1]=3;
@@ -283,16 +283,16 @@ static void gent_nested_vl(hid_t loc_id)
/* allocate and initialize VL dataset to write */
buf[0].len = 1;
- buf[0].p = malloc( 1 * sizeof(hvl_t));
+ buf[0].p = HDmalloc( 1 * sizeof(hvl_t));
tvl = (hvl_t *)buf[0].p;
- tvl->p = malloc( 1 * sizeof(int) );
+ tvl->p = HDmalloc( 1 * sizeof(int) );
tvl->len = 1;
((int *)tvl->p)[0]=1;
buf[1].len = 1;
- buf[1].p = malloc( 1 * sizeof(hvl_t));
+ buf[1].p = HDmalloc( 1 * sizeof(hvl_t));
tvl = (hvl_t *)buf[1].p;
- tvl->p = malloc( 2 * sizeof(int) );
+ tvl->p = HDmalloc( 2 * sizeof(int) );
tvl->len = 2;
((int *)tvl->p)[0]=2;
((int *)tvl->p)[1]=3;
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index cf46e74..59cab0d 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -174,7 +174,7 @@ void parse_command_line(int argc,
options->exclude_path = 1;
/* create linked list of excluding objects */
- if( (exclude_node = (struct exclude_path_list*) malloc(sizeof(struct exclude_path_list))) == NULL)
+ if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL)
{
printf("Error: lack of memory!\n");
h5diff_exit(EXIT_FAILURE);
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index d7389d3..d554abd 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -4475,7 +4475,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a
for(i=0; i<SDIM_DSET; i++)
{
wdata[i].i1 = i;
- wdata[i].vl.p = malloc((i+1)*sizeof(cmpd2_t));
+ wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
wdata[i].vl.len = i+1;
for(j=0; j<(i+1); j++)
{
@@ -4600,7 +4600,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch
for(j=0; j < SDIM_CMPD_ARRAY; j++)
{
wdata[i].cmpd2[j].i2 = j*10;
- wdata[i].cmpd2[j].vl.p = malloc((j+1)*sizeof(cmpd3_t));
+ wdata[i].cmpd2[j].vl.p = HDmalloc((j+1)*sizeof(cmpd3_t));
wdata[i].cmpd2[j].vl.len = j+1;
for(k=0; k<(j+1); k++)
{
@@ -4744,7 +4744,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch
{
/* compound 1 data */
wdata[i].i1 = i;
- wdata[i].vl.p = malloc((i+1)*sizeof(cmpd2_t));
+ wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t));
wdata[i].vl.len = i+1;
for(j=0; j<(i+1); j++)
{
@@ -5456,10 +5456,10 @@ void write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
- buf5[0].p = malloc( 1 * sizeof(int));
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
((int *)buf5[0].p)[0]=1;
buf5[1].len = 2;
- buf5[1].p = malloc( 2 * sizeof(int));
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
((int *)buf5[1].p)[0]=2;
((int *)buf5[1].p)[1]=3;
@@ -5743,7 +5743,7 @@ void write_attr_in(hid_t loc_id,
n=0;
for (i = 0; i < 3; i++) {
for (j = 0; j < 2; j++) {
- buf52[i][j].p = malloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
@@ -6159,7 +6159,7 @@ void write_attr_in(hid_t loc_id,
for (i = 0; i < 4; i++) {
for (j = 0; j < 3; j++) {
for (k = 0; k < 2; k++) {
- buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)((int *)buf53[i][j][k].p)[l] = 0;
@@ -6490,10 +6490,10 @@ void write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
- buf5[0].p = malloc( 1 * sizeof(int));
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
((int *)buf5[0].p)[0]=1;
buf5[1].len = 2;
- buf5[1].p = malloc( 2 * sizeof(int));
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
((int *)buf5[1].p)[0]=2;
((int *)buf5[1].p)[1]=3;
@@ -6703,7 +6703,7 @@ void write_dset_in(hid_t loc_id,
{
for(j = 0; j < 2; j++)
{
- buf52[i][j].p = malloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = i + 1;
for(l = 0; l < i + 1; l++)
{
@@ -6916,7 +6916,7 @@ void write_dset_in(hid_t loc_id,
{
for(k = 0; k < 2; k++)
{
- buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = i + 1;
for(l = 0; l < i + 1; l++)
{
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index d84f7f2..3aff2b4 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -165,7 +165,7 @@ main (int argc, const char *argv[])
if (res < (long)size)
{
if (buf)
- free (buf);
+ HDfree (buf);
HDclose (fd);
exit (EXIT_FAILURE);
}
@@ -173,7 +173,7 @@ main (int argc, const char *argv[])
HDwrite (1, buf, (unsigned)size);
if (buf)
- free (buf);
+ HDfree (buf);
HDclose (fd);
return (EXIT_SUCCESS);
}
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 791e268..ba6b499 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -3333,7 +3333,7 @@ int make_big(hid_t loc_id)
goto out;
/* initialize buffer to 0 */
- buf=(signed char *) calloc( nelmts, size);
+ buf=(signed char *) HDcalloc( nelmts, size);
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
@@ -3814,10 +3814,10 @@ int write_dset_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
- buf5[0].p = malloc( 1 * sizeof(int));
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
((int *)buf5[0].p)[0]=1;
buf5[1].len = 2;
- buf5[1].p = malloc( 2 * sizeof(int));
+ buf5[1].p = HDmalloc( 2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
@@ -3876,7 +3876,7 @@ int write_dset_in(hid_t loc_id,
/* allocate and initialize array data to write */
size = ( TEST_BUFSIZE / sizeof(double) + 1 ) * sizeof(double);
- dbuf = (double*)malloc( size );
+ dbuf = (double*)HDmalloc( size );
if (NULL == dbuf)
{
printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 );
@@ -4050,7 +4050,7 @@ int write_dset_in(hid_t loc_id,
{
int l;
- buf52[i][j].p = malloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
{
@@ -4271,7 +4271,7 @@ int write_dset_in(hid_t loc_id,
{
int l;
- buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)(i + 1);
for(l = 0; l < i + 1; l++)
{
@@ -4401,8 +4401,8 @@ int make_dset_reg_ref(hid_t loc_id)
int retval = -1; /* return value */
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- dwbuf = (int *)malloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2);
/* Create dataspace for datasets */
if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0)
@@ -4742,10 +4742,10 @@ int write_attr_in(hid_t loc_id,
/* Allocate and initialize VL dataset to write */
buf5[0].len = 1;
- buf5[0].p = malloc( 1 * sizeof(int));
+ buf5[0].p = HDmalloc( 1 * sizeof(int));
((int *)buf5[0].p)[0]=1;
buf5[1].len = 2;
- buf5[1].p = malloc(2 * sizeof(int));
+ buf5[1].p = HDmalloc(2 * sizeof(int));
((int *)buf5[1].p)[0] = 2;
((int *)buf5[1].p)[1] = 3;
@@ -5062,7 +5062,7 @@ int write_attr_in(hid_t loc_id,
for (j = 0; j < 2; j++)
{
int l;
- buf52[i][j].p = malloc((i + 1) * sizeof(int));
+ buf52[i][j].p = HDmalloc((i + 1) * sizeof(int));
buf52[i][j].len = (size_t)(i + 1);
for (l = 0; l < i + 1; l++)
if (make_diffs)((int *)buf52[i][j].p)[l] = 0;
@@ -5528,7 +5528,7 @@ int write_attr_in(hid_t loc_id,
for (k = 0; k < 2; k++)
{
int l;
- buf53[i][j][k].p = malloc((i + 1) * sizeof(int));
+ buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int));
buf53[i][j][k].len = (size_t)i + 1;
for (l = 0; l < i + 1; l++)
if (make_diffs)
@@ -6754,11 +6754,11 @@ static herr_t make_complex_attr_references(hid_t loc_id)
* prepare vlen data
*/
vlen_objref_data[0].len = LEN0_VLEN_OBJREF;
- vlen_objref_data[0].p = malloc (vlen_objref_data[0].len * sizeof(hobj_ref_t));
+ vlen_objref_data[0].p = HDmalloc (vlen_objref_data[0].len * sizeof(hobj_ref_t));
vlen_objref_data[1].len = LEN1_VLEN_OBJREF;
- vlen_objref_data[1].p = malloc (vlen_objref_data[1].len * sizeof(hobj_ref_t));
+ vlen_objref_data[1].p = HDmalloc (vlen_objref_data[1].len * sizeof(hobj_ref_t));
vlen_objref_data[2].len = LEN2_VLEN_OBJREF;
- vlen_objref_data[2].p = malloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
+ vlen_objref_data[2].p = HDmalloc (vlen_objref_data[2].len * sizeof(hobj_ref_t));
/*
* create obj references
@@ -6823,7 +6823,7 @@ static herr_t make_complex_attr_references(hid_t loc_id)
* prepare vlen data
*/
vlen_regref_data[0].len = LEN0_VLEN_REGREF;
- vlen_regref_data[0].p = malloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
+ vlen_regref_data[0].p = HDmalloc (vlen_regref_data[0].len * sizeof(hdset_reg_ref_t));
/*
* create region reference
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index a5d7eef..e9fa0fa 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -823,7 +823,7 @@ freespace_stats(hid_t fid, iter_t *iter)
} /* end for */
if(sect_info)
- free(sect_info);
+ HDfree(sect_info);
return 0;
} /* end freespace_stats() */
@@ -1756,9 +1756,9 @@ main(int argc, const char *argv[])
iter.free_hdr = finfo.free.meta_size;
} /* end else */
- iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long));
- iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
- iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long));
+ iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
+ iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c
index 07f6bfd..ffd52e8 100644
--- a/tools/misc/h5repart.c
+++ b/tools/misc/h5repart.c
@@ -290,7 +290,7 @@ main (int argc, char *argv[])
if (argno<argc) usage (prog_name);
/* Now the real work, split the file */
- buf = malloc (blk_size);
+ buf = HDmalloc (blk_size);
while (src_offset<src_size) {
/* Read a block. The amount to read is the minimum of:
@@ -498,6 +498,6 @@ main (int argc, char *argv[])
}
/* Free resources and return */
- free (buf);
+ HDfree (buf);
return EXIT_SUCCESS;
}
diff --git a/tools/misc/talign.c b/tools/misc/talign.c
index 017eb55..66318bf 100644
--- a/tools/misc/talign.c
+++ b/tools/misc/talign.c
@@ -126,7 +126,7 @@ int main(void)
H5Dclose(set);
/* Now open the set, and read it back in */
- data = (char *)malloc(H5Tget_size(fix));
+ data = (char *)HDmalloc(H5Tget_size(fix));
if(!data) {
perror("malloc() failed");
@@ -152,7 +152,7 @@ out:
mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0),
string5, (char *)(data + H5Tget_member_offset(fix, 0)));
if(mname)
- free(mname);
+ HDfree(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 1));
mname = H5Tget_member_name(fix, 1);
@@ -163,7 +163,7 @@ out:
(double)fok[0], (double)fptr[0],
(double)fok[1], (double)fptr[1]);
if(mname)
- free(mname);
+ HDfree(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 2));
mname = H5Tget_member_name(fix, 2);
@@ -173,7 +173,7 @@ out:
(double)fnok[0], (double)fptr[0],
(double)fnok[1], (double)fptr[1]);
if(mname)
- free(mname);
+ HDfree(mname);
fptr = (float *)(data + H5Tget_member_offset(fix, 1));
printf("\n"
@@ -192,7 +192,7 @@ out:
}
if(data)
- free(data);
+ HDfree(data);
H5Sclose(spc);
H5Tclose(cmp);
H5Tclose(cmp1);