summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-06-28 22:48:12 (GMT)
committerGitHub <noreply@github.com>2023-06-28 22:48:12 (GMT)
commitaebac33a1f290fa5065bce96bb0512317a34c283 (patch)
treecdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /tools/lib
parent605cea4af60cfcbe03a54f697de392eec75e5a85 (diff)
downloadhdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip
hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz
hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2
Remove HD from memory allocate/free calls (#3195)
* HDcalloc * HDfree * HDmalloc * HDrealloc
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c34
-rw-r--r--tools/lib/h5diff_array.c36
-rw-r--r--tools/lib/h5diff_attr.c38
-rw-r--r--tools/lib/h5diff_dset.c56
-rw-r--r--tools/lib/h5tools.c28
-rw-r--r--tools/lib/h5tools_dump.c70
-rw-r--r--tools/lib/h5tools_ref.c6
-rw-r--r--tools/lib/h5tools_str.c36
-rw-r--r--tools/lib/h5tools_utils.c34
-rw-r--r--tools/lib/h5trav.c64
-rw-r--r--tools/lib/io_timer.c4
11 files changed, 203 insertions, 203 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 8f8522b..cb3295f 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -297,7 +297,7 @@ free_exclude_path_list(diff_opt_t *opts)
while (NULL != curr) {
next = curr->next;
- HDfree(curr);
+ free(curr);
curr = next;
}
}
@@ -315,7 +315,7 @@ free_exclude_attr_list(diff_opt_t *opts)
while (NULL != curr) {
next = curr->next;
- HDfree(curr);
+ free(curr);
curr = next;
}
}
@@ -575,7 +575,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata)
done:
if (lnk_info.trg_path)
- HDfree(lnk_info.trg_path);
+ free(lnk_info.trg_path);
H5TOOLS_ENDDEBUG(" ");
return ret_value;
}
@@ -710,7 +710,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- if ((obj1fullname = (char *)HDmalloc(HDstrlen(objname1) + 2)) == NULL)
+ if ((obj1fullname = (char *)malloc(HDstrlen(objname1) + 2)) == NULL)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj1fullname, "/");
@@ -729,7 +729,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
- if ((obj2fullname = (char *)HDmalloc(HDstrlen(objname2) + 2)) == NULL)
+ if ((obj2fullname = (char *)malloc(HDstrlen(objname2) + 2)) == NULL)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj2fullname, "/");
HDstrcat(obj2fullname, objname2);
@@ -1067,15 +1067,15 @@ done:
/* free buffers */
if (obj1fullname)
- HDfree(obj1fullname);
+ free(obj1fullname);
if (obj2fullname)
- HDfree(obj2fullname);
+ free(obj2fullname);
/* free link info buffer */
if (trg_linfo1.trg_path)
- HDfree(trg_linfo1.trg_path);
+ free(trg_linfo1.trg_path);
if (trg_linfo2.trg_path)
- HDfree(trg_linfo2.trg_path);
+ free(trg_linfo2.trg_path);
/* close */
H5E_BEGIN_TRY
@@ -1164,7 +1164,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id,
*/
#ifdef H5_HAVE_PARALLEL
{
- char *workerTasks = (char *)HDmalloc((size_t)(g_nTasks - 1) * sizeof(char));
+ char *workerTasks = (char *)malloc((size_t)(g_nTasks - 1) * sizeof(char));
int n;
int busyTasks = 0;
struct diffs_found nFoundbyWorker;
@@ -1186,7 +1186,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id,
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
#else /* H5_HAVE_ASPRINTF */
- if ((obj1_fullpath = (char *)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) ==
+ if ((obj1_fullpath = (char *)malloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) ==
NULL) {
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
@@ -1204,7 +1204,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id,
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
#else /* H5_HAVE_ASPRINTF */
- if ((obj2_fullpath = (char *)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) ==
+ if ((obj2_fullpath = (char *)malloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) ==
NULL) {
H5TOOLS_ERROR(H5DIFF_ERR, "name buffer allocation failed");
}
@@ -1401,9 +1401,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id,
} /* end else */
#endif /* H5_HAVE_PARALLEL */
if (obj1_fullpath)
- HDfree(obj1_fullpath);
+ free(obj1_fullpath);
if (obj2_fullpath)
- HDfree(obj2_fullpath);
+ free(obj2_fullpath);
} /* end if */
} /* end for */
H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat);
@@ -1493,7 +1493,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id,
} /* end if */
H5TOOLS_DEBUG("done with if block");
- HDfree(workerTasks);
+ free(workerTasks);
}
#endif /* H5_HAVE_PARALLEL */
@@ -1912,9 +1912,9 @@ done:
/* free link info buffer */
if (linkinfo1.trg_path)
- HDfree(linkinfo1.trg_path);
+ free(linkinfo1.trg_path);
if (linkinfo2.trg_path)
- HDfree(linkinfo2.trg_path);
+ free(linkinfo2.trg_path);
/* close */
/* disable error reporting */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 5cb22f1..37c17e5 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -1390,7 +1390,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
alloc_size = (hsize_t)nblocks1 * (unsigned)ndims1 * 2 * sizeof(ptdata1[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if ((ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
+ if ((ptdata1 = (hsize_t *)malloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
@@ -1398,7 +1398,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1);
- if ((ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
+ if ((ptdata2 = (hsize_t *)malloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
@@ -1446,10 +1446,10 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
parallel_print("\n");
}
}
- HDfree(ptdata2);
+ free(ptdata2);
} /* else ptdata2 */
- HDfree(ptdata1);
+ free(ptdata1);
} /* else ptdata1 */
}
@@ -1462,7 +1462,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
alloc_size = (hsize_t)npoints1 * (unsigned)ndims1 * sizeof(ptdata1[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if ((ptdata1 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
+ if ((ptdata1 = (hsize_t *)malloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
@@ -1470,7 +1470,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1);
- if ((ptdata2 = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) {
+ if ((ptdata2 = (hsize_t *)malloc((size_t)alloc_size)) == NULL) {
opts->err_stat = H5DIFF_ERR;
H5TOOLS_INFO("Buffer allocation failed");
}
@@ -1511,7 +1511,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
}
}
}
- HDfree(ptdata2);
+ free(ptdata2);
} /* else ptdata2 */
#if defined(H5DIFF_DEBUG)
@@ -1526,7 +1526,7 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di
parallel_print("\n");
#endif
- HDfree(ptdata1);
+ free(ptdata1);
} /* else ptdata1 */
}
@@ -3101,7 +3101,7 @@ ull2float(unsigned long long ull_value, float *f_value)
src_size = H5Tget_size(H5T_NATIVE_ULLONG);
dst_size = H5Tget_size(H5T_NATIVE_FLOAT);
- if ((buf = (unsigned char *)HDcalloc((size_t)1, MAX(src_size, dst_size))) == NULL)
+ if ((buf = (unsigned char *)calloc((size_t)1, MAX(src_size, dst_size))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims");
HDmemcpy(buf, &ull_value, src_size);
@@ -3120,7 +3120,7 @@ done:
H5E_END_TRY
if (buf)
- HDfree(buf);
+ free(buf);
H5TOOLS_ENDDEBUG(" ");
return ret_value;
@@ -3493,14 +3493,14 @@ get_member_types(hid_t tid, mcomp_t *members)
return;
members->n = (unsigned)nmembs;
- members->ids = (hid_t *)HDcalloc((size_t)members->n, sizeof(hid_t));
- members->offsets = (size_t *)HDcalloc((size_t)members->n, sizeof(size_t));
- members->m = (mcomp_t **)HDcalloc((size_t)members->n, sizeof(mcomp_t *));
+ members->ids = (hid_t *)calloc((size_t)members->n, sizeof(hid_t));
+ members->offsets = (size_t *)calloc((size_t)members->n, sizeof(size_t));
+ members->m = (mcomp_t **)calloc((size_t)members->n, sizeof(mcomp_t *));
for (u = 0; u < members->n; u++) {
members->ids[u] = H5Tget_member_type(tid, u);
members->offsets[u] = H5Tget_member_offset(tid, u);
- members->m[u] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
+ members->m[u] = (mcomp_t *)malloc(sizeof(mcomp_t));
HDmemset(members->m[u], 0, sizeof(mcomp_t));
get_member_types(members->ids[u], members->m[u]);
}
@@ -3523,12 +3523,12 @@ close_member_types(mcomp_t *members)
for (u = 0; u < members->n; u++) {
if (members->m[u]) {
close_member_types(members->m[u]);
- HDfree(members->m[u]);
+ free(members->m[u]);
}
H5Tclose(members->ids[u]);
}
- HDfree(members->m);
- HDfree(members->ids);
- HDfree(members->offsets);
+ free(members->m);
+ free(members->ids);
+ free(members->offsets);
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 5019a14..be70afd 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -45,7 +45,7 @@ typedef struct table_attrs_t {
static void
table_attrs_init(table_attrs_t **tbl)
{
- table_attrs_t *table_attrs = (table_attrs_t *)HDmalloc(sizeof(table_attrs_t));
+ table_attrs_t *table_attrs = (table_attrs_t *)malloc(sizeof(table_attrs_t));
table_attrs->size = 0;
table_attrs->nattrs = 0;
@@ -77,13 +77,13 @@ table_attrs_free(table_attrs_t *table)
if (table->attrs) {
for (i = 0; i < table->nattrs; i++) {
if (table->attrs[i].name) {
- HDfree(table->attrs[i].name);
+ free(table->attrs[i].name);
}
} /* end for */
- HDfree(table->attrs);
+ free(table->attrs);
table->attrs = NULL;
} /* end if */
- HDfree(table);
+ free(table);
table = NULL;
}
}
@@ -109,7 +109,7 @@ table_attr_mark_exist(const unsigned *exist, char *name, table_attrs_t *table)
match_attr_t *new_attrs;
table->size = MAX(1, table->size * 2);
- new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
+ new_attrs = (match_attr_t *)realloc(table->attrs, table->size * sizeof(match_attr_t));
if (new_attrs)
table->attrs = new_attrs;
} /* end if */
@@ -396,7 +396,7 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na
sz = HDstrlen(name1);
H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
if (sz > 0) {
- opts->obj_name[0] = (char *)HDmalloc(sz + 1);
+ opts->obj_name[0] = (char *)malloc(sz + 1);
HDstrncpy(opts->obj_name[0], name1, sz + 1);
}
}
@@ -404,7 +404,7 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na
sz = HDstrlen(name2);
H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
if (sz > 0) {
- opts->obj_name[1] = (char *)HDmalloc(sz + 1);
+ opts->obj_name[1] = (char *)malloc(sz + 1);
HDstrncpy(opts->obj_name[1], name2, sz + 1);
}
}
@@ -440,8 +440,8 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na
* read
*----------------------------------------------------------------------
*/
- buf1 = (void *)HDcalloc((size_t)(opts->nelmts), msize1);
- buf2 = (void *)HDcalloc((size_t)(opts->nelmts), msize2);
+ buf1 = (void *)calloc((size_t)(opts->nelmts), msize1);
+ buf2 = (void *)calloc((size_t)(opts->nelmts), msize2);
H5TOOLS_DEBUG("attr buffer size %ld * %ld", opts->nelmts, msize1);
if (buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
@@ -465,24 +465,24 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na
/* format output string */
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ free(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ free(opts->obj_name[1]);
opts->obj_name[1] = NULL;
H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2);
if (name1) {
sz = HDstrlen(name1) + HDstrlen(path1) + 7;
H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
- opts->obj_name[0] = (char *)HDcalloc(sz + 1, sizeof(char));
+ opts->obj_name[0] = (char *)calloc(sz + 1, sizeof(char));
HDsnprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1);
opts->obj_name[0][sz] = '\0';
}
if (name2) {
sz = HDstrlen(name2) + HDstrlen(path2) + 7;
H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
- opts->obj_name[1] = (char *)HDcalloc(sz + 1, sizeof(char));
+ opts->obj_name[1] = (char *)calloc(sz + 1, sizeof(char));
HDsnprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2);
opts->obj_name[1][sz] = '\0';
}
@@ -531,22 +531,22 @@ diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *na
*----------------------------------------------------------------------
*/
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ free(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ free(opts->obj_name[1]);
opts->obj_name[1] = NULL;
/* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
* VLEN memory first */
if (TRUE == h5tools_detect_vlen(mtype1_id))
H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
+ free(buf1);
buf1 = NULL;
if (TRUE == h5tools_detect_vlen(mtype2_id))
H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
+ free(buf2);
buf2 = NULL;
if (H5Tclose(ftype1_id) < 0)
@@ -570,12 +570,12 @@ done:
if (buf1) {
if (buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
+ free(buf1);
} /* end if */
if (buf2) {
if (buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
+ free(buf2);
} /* end if */
H5Tclose(ftype1_id);
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 61f4044..c0c5ba1 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -277,7 +277,7 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
j = (int)HDstrlen(obj1_name);
H5TOOLS_DEBUG("obj1_name: %s - %d", obj1_name, j);
if (j > 0) {
- opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1);
+ opts->obj_name[0] = (char *)malloc((size_t)j + 1);
HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j + 1);
}
}
@@ -287,7 +287,7 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
j = (int)HDstrlen(obj2_name);
H5TOOLS_DEBUG("obj2_name: %s - %d", obj2_name, j);
if (j > 0) {
- opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1);
+ opts->obj_name[1] = (char *)malloc((size_t)j + 1);
HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j + 1);
}
}
@@ -424,10 +424,10 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name);
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ free(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ free(opts->obj_name[1]);
opts->obj_name[1] = NULL;
if (obj1_name)
@@ -442,8 +442,8 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
*-----------------------------------------------------------------
*/
if (need < H5TOOLS_MALLOCSIZE) {
- buf1 = HDmalloc(need);
- buf2 = HDmalloc(need);
+ buf1 = malloc(need);
+ buf2 = malloc(need);
} /* end if */
/* Assume entire data space to be printed */
@@ -478,11 +478,11 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
if (vl_data2)
H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
if (buf1 != NULL) {
- HDfree(buf1);
+ free(buf1);
buf1 = NULL;
}
if (buf2 != NULL) {
- HDfree(buf2);
+ free(buf2);
buf2 = NULL;
}
} /* end if */
@@ -520,14 +520,14 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
/* reclaim any VL memory, if necessary */
if (vl_data1)
H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
- HDfree(buf1);
+ free(buf1);
buf1 = NULL;
}
if (buf2 != NULL) {
/* reclaim any VL memory, if necessary */
if (vl_data2)
H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
- HDfree(buf2);
+ free(buf2);
buf2 = NULL;
}
@@ -557,26 +557,26 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* dimensions */
if (!opts->sset[0]->start.data) {
/* default to (0, 0, ...) for the start coord */
- opts->sset[0]->start.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->start.data = (hsize_t *)calloc((size_t)rank1, sizeof(hsize_t));
opts->sset[0]->start.len = (unsigned)rank1;
}
if (!opts->sset[0]->stride.data) {
- opts->sset[0]->stride.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->stride.data = (hsize_t *)calloc((size_t)rank1, sizeof(hsize_t));
opts->sset[0]->stride.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->stride.data[i] = 1;
}
if (!opts->sset[0]->count.data) {
- opts->sset[0]->count.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->count.data = (hsize_t *)calloc((size_t)rank1, sizeof(hsize_t));
opts->sset[0]->count.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->count.data[i] = 1;
}
if (!opts->sset[0]->block.data) {
- opts->sset[0]->block.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->block.data = (hsize_t *)calloc((size_t)rank1, sizeof(hsize_t));
opts->sset[0]->block.len = (unsigned)rank1;
for (i = 0; i < rank1; i++)
opts->sset[0]->block.data[i] = 1;
@@ -618,26 +618,26 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
* dimensions */
if (!opts->sset[1]->start.data) {
/* default to (0, 0, ...) for the start coord */
- opts->sset[1]->start.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->start.data = (hsize_t *)calloc((size_t)rank2, sizeof(hsize_t));
opts->sset[1]->start.len = (unsigned)rank2;
}
if (!opts->sset[1]->stride.data) {
- opts->sset[1]->stride.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->stride.data = (hsize_t *)calloc((size_t)rank2, sizeof(hsize_t));
opts->sset[1]->stride.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->stride.data[i] = 1;
}
if (!opts->sset[1]->count.data) {
- opts->sset[1]->count.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->count.data = (hsize_t *)calloc((size_t)rank2, sizeof(hsize_t));
opts->sset[1]->count.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->count.data[i] = 1;
}
if (!opts->sset[1]->block.data) {
- opts->sset[1]->block.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->block.data = (hsize_t *)calloc((size_t)rank2, sizeof(hsize_t));
opts->sset[1]->block.len = (unsigned)rank2;
for (i = 0; i < rank2; i++)
opts->sset[1]->block.data[i] = 1;
@@ -696,9 +696,9 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
for (elmtno = 0; elmtno < opts->nelmts; elmtno += opts->hs_nelmts) {
H5TOOLS_DEBUG("elmtno: %ld - hs_nelmts1: %ld", elmtno, hs_nelmts1);
- if (NULL == (sm_buf1 = (unsigned char *)HDmalloc((size_t)sm_nbytes)))
+ if (NULL == (sm_buf1 = (unsigned char *)malloc((size_t)sm_nbytes)))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
- if (NULL == (sm_buf2 = (unsigned char *)HDmalloc((size_t)sm_nbytes)))
+ if (NULL == (sm_buf2 = (unsigned char *)malloc((size_t)sm_nbytes)))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
/* calculate the hyperslab size */
@@ -809,14 +809,14 @@ diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_n
/* reclaim any VL memory, if necessary */
if (vl_data1)
H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
- HDfree(sm_buf1);
+ free(sm_buf1);
sm_buf1 = NULL;
}
if (sm_buf2 != NULL) {
/* reclaim any VL memory, if necessary */
if (vl_data2)
H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
- HDfree(sm_buf2);
+ free(sm_buf2);
sm_buf2 = NULL;
}
@@ -878,10 +878,10 @@ done:
H5TOOLS_DEBUG("free names - errstat:%d", opts->err_stat);
/* free */
if (opts->obj_name[0] != NULL)
- HDfree(opts->obj_name[0]);
+ free(opts->obj_name[0]);
opts->obj_name[0] = NULL;
if (opts->obj_name[1] != NULL)
- HDfree(opts->obj_name[1]);
+ free(opts->obj_name[1]);
opts->obj_name[1] = NULL;
H5TOOLS_DEBUG("reclaim any VL memory");
@@ -889,14 +889,14 @@ done:
/* reclaim any VL memory, if necessary */
if (vl_data1)
H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
- HDfree(buf1);
+ free(buf1);
buf1 = NULL;
}
if (buf2 != NULL) {
/* reclaim any VL memory, if necessary */
if (vl_data2)
H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
- HDfree(buf2);
+ free(buf2);
buf2 = NULL;
}
H5TOOLS_DEBUG("reclaim any stripmine VL memory");
@@ -904,14 +904,14 @@ done:
/* reclaim any VL memory, if necessary */
if (vl_data1)
H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
- HDfree(sm_buf1);
+ free(sm_buf1);
sm_buf1 = NULL;
}
if (sm_buf2 != NULL) {
/* reclaim any VL memory, if necessary */
if (vl_data2)
H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
- HDfree(sm_buf2);
+ free(sm_buf2);
sm_buf2 = NULL;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index e0e3e06..50c6aae 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -2043,7 +2043,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t contai
H5TOOLS_THROW((-1), "H5Dget_space failed");
/* Allocate space for the dimension array */
- if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
/* find the dimensions of each data space from the block coordinates */
@@ -2060,15 +2060,15 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t contai
if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
- if ((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
+ if ((region_buf = malloc(type_size * (size_t)numelem)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if ((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((start = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for start");
- if ((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((count = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for count");
for (blkndx = 0; blkndx < nblocks; blkndx++) {
@@ -2093,10 +2093,10 @@ done:;
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
CATCH
- HDfree(start);
- HDfree(count);
- HDfree(region_buf);
- HDfree(dims1);
+ free(start);
+ free(count);
+ free(region_buf);
+ free(dims1);
if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
@@ -2142,7 +2142,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *strea
ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
- if ((ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL)
+ if ((ptdata = (hsize_t *)malloc((size_t)alloc_size)) == NULL)
H5TOOLS_GOTO_ERROR(FALSE, "Could not allocate buffer for ptdata");
if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
@@ -2156,7 +2156,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *strea
render_bin_output_region_data_blocks(region_id, stream, container, ndims, type_id, nblocks, ptdata);
done:
- HDfree(ptdata);
+ free(ptdata);
if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(FALSE, "H5Tclose failed");
@@ -2202,11 +2202,11 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *
if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
- if ((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
+ if ((region_buf = malloc(type_size * (size_t)npoints)) == NULL)
H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for region");
/* Allocate space for the dimension array */
- if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR((-1), "Could not allocate buffer for dims");
dims1[0] = npoints;
@@ -2222,8 +2222,8 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *
H5TOOLS_GOTO_ERROR((-1), "render_bin_output of data points failed");
done:
- HDfree(region_buf);
- HDfree(dims1);
+ free(region_buf);
+ free(dims1);
if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 1273065..df91842 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -514,7 +514,7 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed");
/* Allocate space for the dimension array */
- if ((dims1 = (hsize_t *)HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL)
+ if ((dims1 = (hsize_t *)malloc((size_t)(sizeof(hsize_t) * ndims))) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims");
/* find the dimensions of each data space from the block coordinates */
@@ -528,15 +528,15 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
if ((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Screate_simple failed");
- if ((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
+ if ((region_buf = malloc(type_size * (size_t)numelem)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate region buffer");
/* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
/* 1 2 n 1 2 n */
- if ((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((start = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for start");
- if ((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((count = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for count");
curr_pos = 0;
@@ -614,10 +614,10 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
done:
- HDfree(start);
- HDfree(count);
- HDfree(region_buf);
- HDfree(dims1);
+ free(start);
+ free(count);
+ free(region_buf);
+ free(dims1);
if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR(FAIL, "H5Sclose failed");
@@ -713,7 +713,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if ((ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL)
+ if ((ptdata = (hsize_t *)malloc((size_t)alloc_size)) == NULL)
H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata");
if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0)
@@ -809,7 +809,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea
}
done:
- HDfree(ptdata);
+ free(ptdata);
if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
@@ -903,7 +903,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
- if ((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ if ((dims1 = (hsize_t *)malloc(sizeof(hsize_t) * ndims)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
dims1[0] = npoints;
@@ -915,7 +915,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre
if ((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
- if ((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
+ if ((region_buf = malloc(type_size * (size_t)npoints)) == NULL)
H5TOOLS_THROW((-1), "Could not allocate buffer for region");
curr_pos = 0;
@@ -978,9 +978,9 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre
} /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
done:
- HDfree(region_buf);
+ free(region_buf);
CATCH
- HDfree(dims1);
+ free(dims1);
if (H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
@@ -1072,7 +1072,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)))
+ if (NULL == (ptdata = (hsize_t *)malloc((size_t)alloc_size)))
H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata");
if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, npoints, ptdata) < 0)
@@ -1164,7 +1164,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea
}
done:
- HDfree(ptdata);
+ free(ptdata);
if (type_id > 0 && H5Tclose(type_id) < 0)
H5TOOLS_ERROR(dimension_break, "H5Tclose failed");
@@ -1321,7 +1321,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
}
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
- if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nelmts * p_type_nbytes)))
+ if (NULL == (sm_buf = (unsigned char *)malloc((size_t)sm_nelmts * p_type_nbytes)))
H5TOOLS_THROW(FAIL, "Could not allocate buffer for strip-mine");
if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
@@ -1370,7 +1370,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
if (H5Sclose(sm_space) < 0)
H5TOOLS_THROW(FAIL, "H5Sclose failed");
if (sm_buf)
- HDfree(sm_buf);
+ free(sm_buf);
sm_buf = NULL;
}
else
@@ -1382,7 +1382,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
CATCH
if (sm_buf)
- HDfree(sm_buf);
+ free(sm_buf);
H5TOOLS_ENDDEBUG(" ");
return ret_value;
@@ -1700,7 +1700,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
goto done;
assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/
- if (NULL != (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) {
+ if (NULL != (sm_buf = (unsigned char *)malloc((size_t)sm_nbytes))) {
H5TOOLS_DEBUG("stripmine size:%ld", sm_nbytes);
sm_nelmts = sm_nbytes / p_type_nbytes;
@@ -1772,7 +1772,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
ctx->continuation++;
H5TOOLS_DEBUG("stripmine read loop:%d complete", i);
}
- HDfree(sm_buf);
+ free(sm_buf);
} /* if (NULL != (sm_buf...)) */
done:
@@ -1849,7 +1849,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
alloc_size = p_nelmts * H5Tget_size(p_type);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) {
+ if (NULL != (buf = (unsigned char *)malloc((size_t)alloc_size))) {
H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims);
H5TOOLS_DEBUG("Read the data");
@@ -1865,7 +1865,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
}
else
H5TOOLS_ERROR((-1), "H5Aread failed");
- HDfree(buf);
+ free(buf);
} /* if (NULL != (buf...)) */
done:
if (f_space >= 0 && H5Sclose(f_space) < 0)
@@ -2776,9 +2776,9 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
dst_size = type_size;
/* Get the names and raw values of all members */
- if (NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
+ if (NULL == (name = (char **)calloc((size_t)nmembs, sizeof(char *))))
H5TOOLS_THROW((-1), "Could not allocate buffer for member name");
- if (NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
+ if (NULL == (value = (unsigned char *)calloc((size_t)nmembs, MAX(type_size, dst_size))))
H5TOOLS_THROW((-1), "Could not allocate buffer for member value");
for (i = 0; i < nmembs; i++) {
@@ -2840,11 +2840,11 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
for (i = 0; i < nmembs; i++)
if (name[i])
H5free_memory(name[i]);
- HDfree(name);
+ free(name);
} /* end if */
if (value)
- HDfree(value);
+ free(value);
if (super >= 0 && H5Tclose(super) < 0)
H5TOOLS_THROW((-1), "Could not close datatype's super class");
@@ -3081,7 +3081,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer /*in,out*/, const h5tool_format_t
n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
size = H5Tget_size(n_type);
- buf = HDmalloc(size);
+ buf = malloc(size);
H5Pget_fill_value(dcpl, n_type, buf);
@@ -3090,7 +3090,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer /*in,out*/, const h5tool_format_t
H5Tclose(n_type);
if (buf)
- HDfree(buf);
+ free(buf);
}
/*-------------------------------------------------------------------------
@@ -3782,7 +3782,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_
/* call H5Oget_comment again with the correct value */
if (cmt_bufsize > 0) {
- comment = (char *)HDmalloc((size_t)(cmt_bufsize + 1)); /* new_size including null terminator */
+ comment = (char *)malloc((size_t)(cmt_bufsize + 1)); /* new_size including null terminator */
if (comment) {
cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize);
if (cmt_bufsize > 0) {
@@ -3797,7 +3797,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_
h5tools_str_close(&buffer);
}
- HDfree(comment);
+ free(comment);
}
}
} /* end dump_comment() */
@@ -4356,23 +4356,23 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
datactx.need_prefix = TRUE;
if (NULL !=
- (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
+ (ref_buf = (H5R_ref_t *)calloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
if (obj_data) {
if (H5Dread(obj_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) {
- HDfree(ref_buf);
+ free(ref_buf);
H5TOOLS_INFO("H5Dread reference failed");
H5TOOLS_GOTO_DONE_NO_RET();
}
}
else {
if (H5Aread(obj_id, H5T_STD_REF, ref_buf) < 0) {
- HDfree(ref_buf);
+ free(ref_buf);
H5TOOLS_INFO("H5Aread reference failed");
H5TOOLS_GOTO_DONE_NO_RET();
}
}
h5tools_dump_reference(stream, &outputformat, &datactx, obj_id, ref_buf, ndims);
- HDfree(ref_buf);
+ free(ref_buf);
}
ctx->indent_level--;
}
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 33f9dd6..59f9ece 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -58,8 +58,8 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op
{
ref_path_node_t *node = (ref_path_node_t *)item;
- HDfree(node->path);
- HDfree(node);
+ free(node->path);
+ free(node);
return (0);
}
@@ -239,7 +239,7 @@ ref_path_table_put(const char *path, const H5O_token_t *token)
ref_path_node_t *new_node;
if (ref_path_table && path) {
- if ((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
+ if ((new_node = (ref_path_node_t *)malloc(sizeof(ref_path_node_t))) == NULL)
return (-1);
HDmemcpy(&new_node->obj_token, token, sizeof(H5O_token_t));
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index a923a52..7428a78 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -64,7 +64,7 @@ void
h5tools_str_close(h5tools_str_t *str)
{
if (str && str->nalloc) {
- HDfree(str->s);
+ free(str->s);
HDmemset(str, 0, sizeof(h5tools_str_t));
}
}
@@ -150,7 +150,7 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...)
*/
size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc);
assert(newsize > str->nalloc); /*overflow*/
- str->s = (char *)HDrealloc(str->s, newsize);
+ str->s = (char *)realloc(str->s, newsize);
assert(str->s);
str->nalloc = newsize;
}
@@ -183,7 +183,7 @@ h5tools_str_reset(h5tools_str_t *str /*in,out*/)
{
if (!str->s || str->nalloc <= 0) {
str->nalloc = STR_INIT_LEN;
- str->s = (char *)HDmalloc(str->nalloc);
+ str->s = (char *)malloc(str->nalloc);
assert(str->s);
}
@@ -253,7 +253,7 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt)
size_t n = sizeof(_temp);
if (str->len - start + 1 > n) {
n = str->len - start + 1;
- temp = (char *)HDmalloc(n);
+ temp = (char *)malloc(n);
assert(temp);
}
@@ -269,7 +269,7 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt)
/* Free the temp buffer if we allocated one */
if (temp != _temp)
- HDfree(temp);
+ free(temp);
return str->s;
}
@@ -472,7 +472,7 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_for
nblocks = (hsize_t)snblocks;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata = (hsize_t *)HDmalloc((size_t)alloc_size);
+ ptdata = (hsize_t *)malloc((size_t)alloc_size);
H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, nblocks, ptdata);
for (u = 0; u < nblocks; u++) {
@@ -493,7 +493,7 @@ h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_for
H5_GCC_CLANG_DIAG_ON("format-nonliteral")
}
- HDfree(ptdata);
+ free(ptdata);
} /* end if (nblocks > 0) */
}
@@ -533,7 +533,7 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_for
npoints = (hsize_t)snpoints;
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
- ptdata = (hsize_t *)HDmalloc((size_t)alloc_size);
+ ptdata = (hsize_t *)malloc((size_t)alloc_size);
H5Sget_select_elem_pointlist(rspace, (hsize_t)0, npoints, ptdata);
for (u = 0; u < npoints; u++) {
@@ -550,7 +550,7 @@ h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_for
H5_GCC_CLANG_DIAG_ON("format-nonliteral")
}
- HDfree(ptdata);
+ free(ptdata);
} /* end if (npoints > 0) */
}
@@ -1442,38 +1442,38 @@ h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
buf_size = H5Rget_file_name(ref_vp, NULL, 0);
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
- char *file_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ char *file_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1);
if (H5Rget_file_name(ref_vp, file_name, (size_t)buf_size + 1) >= 0) {
file_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", file_name);
h5tools_str_append(str, "%s", file_name);
}
- HDfree(file_name);
+ free(file_name);
}
buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0);
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
- char *obj_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ char *obj_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1);
if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, (size_t)buf_size + 1) >= 0) {
obj_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", obj_name);
h5tools_str_append(str, "%s", obj_name);
}
- HDfree(obj_name);
+ free(obj_name);
}
if (H5Rget_type(ref_vp) == H5R_ATTR) {
buf_size = H5Rget_attr_name(ref_vp, NULL, 0);
H5TOOLS_DEBUG("buf_size=%ld", buf_size);
if (buf_size) {
- char *attr_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ char *attr_name = (char *)malloc(sizeof(char) * (size_t)buf_size + 1);
if (H5Rget_attr_name(ref_vp, attr_name, (size_t)buf_size + 1) >= 0) {
attr_name[buf_size] = '\0';
H5TOOLS_DEBUG("name=%s", attr_name);
h5tools_str_append(str, "/%s", attr_name);
}
- HDfree(attr_name);
+ free(attr_name);
}
}
h5tools_str_append(str, "\"");
@@ -1622,10 +1622,10 @@ h5tools_str_replace(const char *string, const char *substr, const char *replacem
char *oldstr;
oldstr = newstr;
- newstr = (char *)HDmalloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1);
+ newstr = (char *)malloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1);
if (newstr == NULL) {
- HDfree(oldstr);
+ free(oldstr);
return NULL;
}
HDmemcpy(newstr, oldstr, (size_t)(tok - oldstr));
@@ -1635,7 +1635,7 @@ h5tools_str_replace(const char *string, const char *substr, const char *replacem
HDmemset(newstr + HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement), 0, 1);
/* move back head right after the last replacement */
head = newstr + (tok - oldstr) + HDstrlen(replacement);
- HDfree(oldstr);
+ free(oldstr);
}
return newstr;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 6cc9125..dd69eb8 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -205,7 +205,7 @@ parse_hsize_list(const char *h_list, subset_d *d)
H5TOOLS_DEBUG("Number integers to read=%ld", size_count);
/* allocate an array for the integers in the list */
- if ((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
+ if ((p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t))) == NULL)
H5TOOLS_INFO("Unable to allocate space for subset data");
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
@@ -247,7 +247,7 @@ parse_subset_params(const char *dset)
if ((brace = HDstrrchr(q_dset, '[')) != NULL) {
*brace++ = '\0';
- s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ s = (struct subset_t *)calloc(1, sizeof(struct subset_t));
parse_hsize_list(brace, &s->start);
while (*brace && *brace != ';')
@@ -383,7 +383,7 @@ parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char *
/* create list
*/
- elems = (char **)HDmalloc(sizeof(char *) * (init_slots + 1));
+ elems = (char **)malloc(sizeof(char *) * (init_slots + 1));
if (elems == NULL) {
ret_value = FAIL;
goto done;
@@ -391,8 +391,8 @@ parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char *
/* create destination string
*/
- start++; /* advance past opening paren '(' */
- cpy = (char *)HDmalloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */
+ start++; /* advance past opening paren '(' */
+ cpy = (char *)malloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */
if (cpy == NULL) {
ret_value = FAIL;
goto done;
@@ -541,12 +541,12 @@ print_version(const char *progname)
static void
init_table(hid_t fid, table_t **tbl)
{
- table_t *table = (table_t *)HDmalloc(sizeof(table_t));
+ table_t *table = (table_t *)malloc(sizeof(table_t));
table->fid = fid;
table->size = 20;
table->nobjs = 0;
- table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
+ table->objs = (obj_t *)malloc(table->size * sizeof(obj_t));
*tbl = table;
}
@@ -568,10 +568,10 @@ free_table(table_t *table)
/* Free the names for the objects in the table */
for (u = 0; u < table->nobjs; u++)
if (table->objs[u].objname)
- HDfree(table->objs[u].objname);
+ free(table->objs[u].objname);
- HDfree(table->objs);
- HDfree(table);
+ free(table->objs);
+ free(table);
}
#ifdef H5DUMP_DEBUG
@@ -701,7 +701,7 @@ find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_see
add_obj(info->type_table, &oinfo->token, name, TRUE);
else {
/* Use latest version of name */
- HDfree(found_obj->objname);
+ free(found_obj->objname);
found_obj->objname = HDstrdup(name);
/* Mark named datatype as having valid name */
@@ -780,7 +780,7 @@ add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool
/* See if we need to make table larger */
if (table->nobjs == table->size) {
table->size *= 2;
- table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
+ table->objs = (struct obj_t *)realloc(table->objs, table->size * sizeof(table->objs[0]));
} /* end if */
/* Increment number of objects in table */
@@ -870,7 +870,7 @@ H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t
H5TOOLS_GOTO_DONE(2);
/* trg_path must be freed out of this function when finished using */
- if ((link_info->trg_path = (char *)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
+ if ((link_info->trg_path = (char *)calloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) {
if (link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to allocate buffer for <%s>\n", linkpath);
H5TOOLS_GOTO_DONE(FAIL);
@@ -1053,9 +1053,9 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t
done:
if (s3cred)
- HDfree(s3cred);
+ free(s3cred);
if (s3cred_src)
- HDfree(s3cred_src);
+ free(s3cred_src);
return ret_value;
}
@@ -1291,9 +1291,9 @@ h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim, H5FD_hdfs_fapl_t
done:
if (props)
- HDfree(props);
+ free(props);
if (props_src)
- HDfree(props_src);
+ free(props_src);
return ret_value;
}
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 4ee2914..060a33b 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -120,7 +120,7 @@ trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path)
if (visited->nused == visited->nalloc) {
visited->nalloc = MAX(1, visited->nalloc * 2);
visited->objs =
- (trav_addr_path_t *)HDrealloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t));
+ (trav_addr_path_t *)realloc(visited->objs, visited->nalloc * sizeof(trav_addr_path_t));
} /* end if */
/* Append it */
@@ -177,7 +177,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_uda
size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 +
3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
- if (NULL == (new_name = (char *)HDmalloc(new_name_len)))
+ if (NULL == (new_name = (char *)malloc(new_name_len)))
return (H5_ITER_ERROR);
if (add_slash)
HDsnprintf(new_name, new_name_len, "%s/%s", udata->base_grp_name, path);
@@ -195,7 +195,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_uda
/* Get information about the object */
if (H5Oget_info_by_name3(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
if (new_name)
- HDfree(new_name);
+ free(new_name);
return (H5_ITER_ERROR);
} /* end if */
@@ -210,7 +210,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_uda
if (udata->visitor->visit_obj)
if ((*udata->visitor->visit_obj)(full_name, &oinfo, already_visited, udata->visitor->udata) < 0) {
if (new_name)
- HDfree(new_name);
+ free(new_name);
return (H5_ITER_ERROR);
} /* end if */
} /* end if */
@@ -219,13 +219,13 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo, void *_uda
if (udata->visitor->visit_lnk)
if ((*udata->visitor->visit_lnk)(full_name, linfo, udata->visitor->udata) < 0) {
if (new_name)
- HDfree(new_name);
+ free(new_name);
return (H5_ITER_ERROR);
} /* end if */
} /* end else */
if (new_name)
- HDfree(new_name);
+ free(new_name);
return (H5_ITER_CONT);
} /* end traverse_cb() */
@@ -295,8 +295,8 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, hbool_t recur
/* Free paths to objects */
for (u = 0; u < seen.nused; u++)
- HDfree(seen.objs[u].path);
- HDfree(seen.objs);
+ free(seen.objs[u].path);
+ free(seen.objs);
} /* end if */
} /* end if */
@@ -321,7 +321,7 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
/* Allocate space if necessary */
if (info->nused == info->nalloc) {
info->nalloc = MAX(1, info->nalloc * 2);
- info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t));
+ info->paths = (trav_path_t *)realloc(info->paths, info->nalloc * sizeof(trav_path_t));
} /* end if */
/* Append it */
@@ -474,7 +474,7 @@ h5trav_getindex(const trav_info_t *info, const char *obj)
void
trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
{
- trav_info_t *info = (trav_info_t *)HDmalloc(sizeof(trav_info_t));
+ trav_info_t *info = (trav_info_t *)malloc(sizeof(trav_info_t));
/* Init info structure */
info->nused = info->nalloc = 0;
@@ -505,16 +505,16 @@ trav_info_free(trav_info_t *info)
/* Free visited symbolic links path and file (if alloc) */
for (u = 0; u < info->symlink_visited.nused; u++) {
if (info->symlink_visited.objs[u].file)
- HDfree(info->symlink_visited.objs[u].file);
- HDfree(info->symlink_visited.objs[u].path);
+ free(info->symlink_visited.objs[u].file);
+ free(info->symlink_visited.objs[u].path);
}
- HDfree(info->symlink_visited.objs);
+ free(info->symlink_visited.objs);
/* Free path names */
for (u = 0; u < info->nused; u++)
- HDfree(info->paths[u].path);
- HDfree(info->paths);
- HDfree(info);
+ free(info->paths[u].path);
+ free(info->paths);
+ free(info);
} /* end if */
} /* end trav_info_free() */
@@ -653,7 +653,7 @@ trav_table_add(trav_table_t *table, const char *path, const H5O_info2_t *oinfo)
if (table) {
if (table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ table->objs = (trav_obj_t *)realloc(table->objs, table->size * sizeof(trav_obj_t));
} /* end if */
new_obj = table->nobjs++;
@@ -700,7 +700,7 @@ trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char
/* allocate space if necessary */
if (table->objs[i].nlinks == (unsigned)table->objs[i].sizelinks) {
table->objs[i].sizelinks = MAX(1, table->objs[i].sizelinks * 2);
- table->objs[i].links = (trav_link_t *)HDrealloc(
+ table->objs[i].links = (trav_link_t *)realloc(
table->objs[i].links, table->objs[i].sizelinks * sizeof(trav_link_t));
} /* end if */
@@ -730,7 +730,7 @@ trav_table_addflags(const unsigned *flags, char *name, h5trav_type_t type, trav_
if (table) {
if (table->nobjs == table->size) {
table->size = MAX(1, table->size * 2);
- table->objs = (trav_obj_t *)HDrealloc(table->objs, table->size * sizeof(trav_obj_t));
+ table->objs = (trav_obj_t *)realloc(table->objs, table->size * sizeof(trav_obj_t));
} /* end if */
new_obj = table->nobjs++;
@@ -760,7 +760,7 @@ trav_table_addflags(const unsigned *flags, char *name, h5trav_type_t type, trav_
void
trav_table_init(hid_t fid, trav_table_t **tbl)
{
- trav_table_t *table = (trav_table_t *)HDmalloc(sizeof(trav_table_t));
+ trav_table_t *table = (trav_table_t *)malloc(sizeof(trav_table_t));
if (table) {
table->fid = fid;
table->size = 0;
@@ -786,19 +786,19 @@ trav_table_free(trav_table_t *table)
unsigned int i;
for (i = 0; i < table->nobjs; i++) {
- HDfree(table->objs[i].name);
+ free(table->objs[i].name);
if (table->objs[i].nlinks) {
unsigned int j;
for (j = 0; j < table->objs[i].nlinks; j++)
- HDfree(table->objs[i].links[j].new_name);
+ free(table->objs[i].links[j].new_name);
- HDfree(table->objs[i].links);
+ free(table->objs[i].links);
} /* end if */
} /* end for */
- HDfree(table->objs);
+ free(table->objs);
} /* end if */
- HDfree(table);
+ free(table);
}
}
@@ -947,14 +947,14 @@ trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
switch (linfo->type) {
case H5L_TYPE_SOFT:
if (linfo->u.val_size > 0) {
- char *targbuf = (char *)HDmalloc(linfo->u.val_size + 1);
+ char *targbuf = (char *)malloc(linfo->u.val_size + 1);
if (targbuf) {
if (H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
targbuf[0] = 0;
printf(" %-10s %s -> %s\n", "link", path, targbuf);
- HDfree(targbuf);
+ free(targbuf);
}
- } /* end if */
+ }
else
printf(" %-10s %s ->\n", "link", path);
break;
@@ -965,13 +965,13 @@ trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
const char *filename = NULL;
const char *objname = NULL;
- targbuf = (char *)HDmalloc(linfo->u.val_size + 1);
+ targbuf = (char *)malloc(linfo->u.val_size + 1);
if (targbuf) {
if (H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0)
targbuf[0] = 0;
if (H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0)
printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
- HDfree(targbuf);
+ free(targbuf);
}
} /* end if */
else
@@ -1073,7 +1073,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
void *tmp_ptr;
visited->nalloc = MAX(1, visited->nalloc * 2);
- if (NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
+ if (NULL == (tmp_ptr = realloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t))))
H5TOOLS_GOTO_ERROR(FAIL, "visited data structure realloc failed");
visited->objs = (symlink_trav_path_t *)tmp_ptr;
} /* end if */
@@ -1095,7 +1095,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co
if (NULL == (visited->objs[idx].path = HDstrdup(path))) {
visited->nused--;
if (visited->objs[idx].file)
- HDfree(visited->objs[idx].file);
+ free(visited->objs[idx].file);
H5TOOLS_GOTO_ERROR(FAIL, "visited data structure path allocation failed");
} /* end if */
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index 17d20f5..d21f919c 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -61,7 +61,7 @@ sub_time(struct timeval *a, struct timeval *b)
io_time_t *
io_time_new(clock_type type)
{
- io_time_t *pt = (io_time_t *)HDcalloc(1, sizeof(struct io_time_t));
+ io_time_t *pt = (io_time_t *)calloc(1, sizeof(struct io_time_t));
/* set global timer variable */
timer_g = pt;
@@ -81,7 +81,7 @@ io_time_new(clock_type type)
void
io_time_destroy(io_time_t *pt)
{
- HDfree(pt);
+ free(pt);
/* reset the global timer pointer too. */
timer_g = NULL;
}