From e6cace9ee46e903a8612aba7d9d1d72fa0968217 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 30 Oct 2013 23:20:36 -0500 Subject: [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. --- c++/test/tcompound.cpp | 56 ++++++++++---------- fortran/src/H5Df.c | 40 +++++++-------- fortran/src/H5Sf.c | 4 +- hl/fortran/src/H5IMcc.c | 4 +- hl/fortran/src/H5IMfc.c | 32 ++++++------ hl/fortran/src/H5LTfc.c | 66 ++++++++++++------------ hl/src/H5DS.c | 94 +++++++++++++++++----------------- hl/src/H5HLprivate2.h | 40 +-------------- hl/src/H5IM.c | 12 ++--- hl/src/H5LT.c | 5 +- hl/src/H5PT.c | 36 +++++++++---- hl/src/H5TB.c | 118 +++++++++++++++++++++---------------------- hl/src/hdf5_hl.h | 2 +- hl/test/gen_test_ds.c | 4 +- hl/test/test_dset_opt.c | 10 ++-- hl/test/test_file_image.c | 10 ++-- test/accum.c | 8 +-- test/cmpd_dset.c | 32 ++++++------ test/dsets.c | 10 ++-- test/dt_arith.c | 74 +++++++++++++-------------- test/dtypes.c | 76 ++++++++++++++-------------- test/h5test.c | 2 +- test/ntypes.c | 4 +- test/tarray.c | 28 +++++----- test/tattr.c | 2 +- test/tgenprop.c | 6 +-- test/tid.c | 14 ++--- test/tmisc.c | 2 +- test/trefer.c | 40 +++++++-------- test/tselect.c | 36 ++++++------- test/tsohm.c | 4 +- test/ttsafe_acreate.c | 4 +- test/ttsafe_cancel.c | 4 +- test/tunicode.c | 4 +- tools/h5copy/h5copygentest.c | 12 ++--- tools/h5diff/h5diff_common.c | 2 +- tools/h5diff/h5diffgentest.c | 22 ++++---- tools/h5jam/getub.c | 4 +- tools/h5repack/h5repacktst.c | 32 ++++++------ tools/h5stat/h5stat.c | 8 +-- tools/misc/h5repart.c | 4 +- tools/misc/talign.c | 10 ++-- 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; ia = 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; ia = 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; ia = 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; ib = (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 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 -#include #include #include +#include +#include #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 + #include "H5PTprivate.h" #include "H5TBprivate.h" -#include + +#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 #include -#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= 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; ia = 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