diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 22:48:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 22:48:12 (GMT) |
commit | aebac33a1f290fa5065bce96bb0512317a34c283 (patch) | |
tree | cdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /tools | |
parent | 605cea4af60cfcbe03a54f697de392eec75e5a85 (diff) | |
download | hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2 |
Remove HD from memory allocate/free calls (#3195)
* HDcalloc
* HDfree
* HDmalloc
* HDrealloc
Diffstat (limited to 'tools')
50 files changed, 887 insertions, 889 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; } diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index d59978b..de8b3ef 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -553,9 +553,9 @@ test_parse_tuple(void) /* TEARDOWN */ assert(parsed != NULL); assert(cpy != NULL); - HDfree(parsed); + free(parsed); parsed = NULL; - HDfree(cpy); + free(cpy); cpy = NULL; } else { @@ -573,9 +573,9 @@ error: ***********/ if (parsed != NULL) - HDfree(parsed); + free(parsed); if (cpy != NULL) - HDfree(cpy); + free(cpy); return 1; diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 62a3905..deae9a9 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -52,15 +52,15 @@ static void leave(int ret) { if (fname_src) - HDfree(fname_src); + free(fname_src); if (fname_dst) - HDfree(fname_dst); + free(fname_dst); if (oname_dst) - HDfree(oname_dst); + free(oname_dst); if (oname_src) - HDfree(oname_src); + free(oname_src); if (str_flag) - HDfree(str_flag); + free(str_flag); h5tools_close(); HDexit(ret); @@ -419,15 +419,15 @@ main(int argc, char *argv[]) if ('/' == oname_dst[i]) { char *str_ptr; - str_ptr = (char *)HDcalloc(i + 1, sizeof(char)); + str_ptr = (char *)calloc(i + 1, sizeof(char)); HDstrncpy(str_ptr, oname_dst, i); str_ptr[i] = '\0'; if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) { error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr); - HDfree(str_ptr); + free(str_ptr); H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lexists failed"); } - HDfree(str_ptr); + free(str_ptr); } } } @@ -458,7 +458,7 @@ main(int argc, char *argv[]) /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); /* close propertis */ if (H5Pclose(ocpl_id) < 0) @@ -479,7 +479,7 @@ done: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); H5E_BEGIN_TRY { diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 5ae2a37..c15603d 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -216,7 +216,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const opts->exclude_path = 1; /* create linked list of excluding objects */ - if ((exclude_node = (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) == + if ((exclude_node = (struct exclude_path_list *)malloc(sizeof(struct exclude_path_list))) == NULL) { printf("Error: lack of memory!\n"); h5diff_exit(EXIT_FAILURE); @@ -249,7 +249,7 @@ parse_command_line(int argc, const char *const *argv, const char **fname1, const /* create linked list of excluding objects */ if ((exclude_attr_node = - (struct exclude_path_list *)HDmalloc(sizeof(struct exclude_path_list))) == NULL) { + (struct exclude_path_list *)malloc(sizeof(struct exclude_path_list))) == NULL) { printf("Error: lack of memory!\n"); h5diff_exit(EXIT_FAILURE); } diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c index 561f139..fd594db 100644 --- a/tools/src/h5diff/h5diff_main.c +++ b/tools/src/h5diff/h5diff_main.c @@ -89,15 +89,15 @@ main(int argc, char *argv[]) for (i = 0; i < 2; i++) { if (opts.sset[i]) { if (opts.sset[i]->start.data) - HDfree(opts.sset[i]->start.data); + free(opts.sset[i]->start.data); if (opts.sset[i]->stride.data) - HDfree(opts.sset[i]->stride.data); + free(opts.sset[i]->stride.data); if (opts.sset[i]->count.data) - HDfree(opts.sset[i]->count.data); + free(opts.sset[i]->count.data); if (opts.sset[i]->block.data) - HDfree(opts.sset[i]->block.data); + free(opts.sset[i]->block.data); - HDfree(opts.sset[i]); + free(opts.sset[i]); opts.sset[i] = NULL; } } diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 62ba1c9..3b17a34 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -416,7 +416,7 @@ table_list_add(hid_t oid, unsigned long file_no) h5dump_table_items_t *tmp_ptr; table_list.nalloc = MAX(1, table_list.nalloc * 2); - if (NULL == (tmp_ptr = (h5dump_table_items_t *)HDrealloc( + if (NULL == (tmp_ptr = (h5dump_table_items_t *)realloc( table_list.tables, table_list.nalloc * sizeof(table_list.tables[0])))) return -1; table_list.tables = tmp_ptr; @@ -493,7 +493,7 @@ table_list_free(void) } /* Free the table list */ - HDfree(table_list.tables); + free(table_list.tables); table_list.tables = NULL; table_list.nalloc = table_list.nused = 0; } /* end table_list_free() */ @@ -708,26 +708,26 @@ free_handler(struct handler_t *hand, int len) if (hand) { for (i = 0; i < len; i++) { if (hand[i].obj) { - HDfree(hand[i].obj); + free(hand[i].obj); hand[i].obj = NULL; } if (hand[i].subset_info) { if (hand[i].subset_info->start.data) - HDfree(hand[i].subset_info->start.data); + free(hand[i].subset_info->start.data); if (hand[i].subset_info->stride.data) - HDfree(hand[i].subset_info->stride.data); + free(hand[i].subset_info->stride.data); if (hand[i].subset_info->count.data) - HDfree(hand[i].subset_info->count.data); + free(hand[i].subset_info->count.data); if (hand[i].subset_info->block.data) - HDfree(hand[i].subset_info->block.data); + free(hand[i].subset_info->block.data); - HDfree(hand[i].subset_info); + free(hand[i].subset_info); hand[i].subset_info = NULL; } } - HDfree(hand); + free(hand); } } @@ -758,7 +758,7 @@ parse_command_line(int argc, const char *const *argv) } /* this will be plenty big enough to hold the info */ - if ((hand = (struct handler_t *)HDcalloc((size_t)argc, sizeof(struct handler_t))) == NULL) { + if ((hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t))) == NULL) { goto error; } @@ -1078,7 +1078,7 @@ parse_start: s = last_dset->subset_info; } else { - last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); + last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); } /* @@ -1096,28 +1096,28 @@ parse_start: switch ((char)opt) { case 's': if (s->start.data) { - HDfree(s->start.data); + free(s->start.data); s->start.data = NULL; } parse_hsize_list(H5_optarg, &s->start); break; case 'S': if (s->stride.data) { - HDfree(s->stride.data); + free(s->stride.data); s->stride.data = NULL; } parse_hsize_list(H5_optarg, &s->stride); break; case 'c': if (s->count.data) { - HDfree(s->count.data); + free(s->count.data); s->count.data = NULL; } parse_hsize_list(H5_optarg, &s->count); break; case 'k': if (s->block.data) { - HDfree(s->block.data); + free(s->block.data); s->block.data = NULL; } parse_hsize_list(H5_optarg, &s->block); @@ -1481,7 +1481,7 @@ main(int argc, char *argv[]) "xsi:schemaLocation=\"http://hdfgroup.org/HDF5/XML/schema/HDF5-File " "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n", xmlnsprefix, ns); - HDfree(ns); + free(ns); } } else { @@ -1554,11 +1554,11 @@ main(int argc, char *argv[]) h5tools_setstatus(EXIT_FAILURE); if (prefix) { - HDfree(prefix); + free(prefix); prefix = NULL; } if (fname) { - HDfree(fname); + free(fname); fname = NULL; } } /* end while */ @@ -1584,11 +1584,11 @@ done: h5tools_setstatus(EXIT_FAILURE); if (prefix) { - HDfree(prefix); + free(prefix); prefix = NULL; } if (fname) { - HDfree(fname); + free(fname); fname = NULL; } @@ -1613,7 +1613,7 @@ static void init_prefix(char **prfx, size_t prfx_len) { if (prfx_len > 0) - *prfx = (char *)HDcalloc(prfx_len, 1); + *prfx = (char *)calloc(prfx_len, 1); else error_msg("unable to allocate prefix buffer\n"); } @@ -1635,7 +1635,7 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) /* Check if we need more space */ if (*prfx_len <= new_len) { *prfx_len = new_len + 1; - *prfx = (char *)HDrealloc(*prfx, *prfx_len); + *prfx = (char *)realloc(*prfx, *prfx_len); } /* Append object name to prefix */ diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 9d59c95..c15bd26 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -187,7 +187,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT outputformat = &string_dataformat; /* Build the object's path name */ - obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + obj_path = (char *)malloc(HDstrlen(prefix) + HDstrlen(name) + 2); if (!obj_path) { ret = FAIL; goto done; @@ -229,7 +229,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT /* Restore old prefix name */ HDstrcpy(prefix, old_prefix); - HDfree(old_prefix); + free(old_prefix); } else error_msg("warning: null prefix\n"); @@ -386,7 +386,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT switch (linfo->type) { case H5L_TYPE_SOFT: - if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + if ((targbuf = (char *)malloc(linfo->u.val_size)) == NULL) { error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -436,12 +436,12 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(targbuf); + free(targbuf); } break; case H5L_TYPE_EXTERNAL: - if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + if ((targbuf = (char *)malloc(linfo->u.val_size)) == NULL) { error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -510,7 +510,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(targbuf); + free(targbuf); } break; @@ -560,7 +560,7 @@ done: h5tools_str_close(&buffer); if (obj_path) - HDfree(obj_path); + free(obj_path); return ret; } @@ -1336,7 +1336,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a u = HDstrlen(buf); v = HDstrlen(op_name); w = u + 1 + v + 1 + 2; - obj_name = (char *)HDmalloc(w); + obj_name = (char *)malloc(w); if (obj_name == NULL) { h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -1359,10 +1359,10 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a buffer_space -= MIN(buffer_space, v); handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); + free(obj_name); } } - HDfree(obj_op_name); + free(obj_op_name); } return ret; } /* end attr_search() */ @@ -1420,7 +1420,7 @@ lnk_search(const char *path, const H5L_info2_t *li, void *_op_data) k = 2; else k = 1; - search_name = (char *)HDmalloc(search_len + k); + search_name = (char *)malloc(search_len + k); if (search_name == NULL) { error_msg("creating temporary link\n"); h5tools_setstatus(EXIT_FAILURE); @@ -1450,7 +1450,7 @@ lnk_search(const char *path, const H5L_info2_t *li, void *_op_data) break; } /* end switch() */ } - HDfree(search_name); + free(search_name); } return 0; } /* end lnk_search() */ @@ -1534,7 +1534,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 hsize_t curr_pos = 0; /* total data element position */ j = (int)HDstrlen(attr) - 1; - obj_name = (char *)HDmalloc((size_t)j + 2); + obj_name = (char *)malloc((size_t)j + 2); if (obj_name == NULL) goto error; @@ -1631,18 +1631,18 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5 goto error; } /* end if */ - HDfree(obj_name); - HDfree(attr_name); + free(obj_name); + free(attr_name); dump_indent -= COL; return; error: h5tools_setstatus(EXIT_FAILURE); if (obj_name) - HDfree(obj_name); + free(obj_name); if (attr_name) - HDfree(attr_name); + free(attr_name); H5E_BEGIN_TRY { @@ -1709,7 +1709,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if (!sset->start.data) { /* default to (0, 0, ...) for the start coord */ if (ndims > 0) - sset->start.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->start.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); else sset->start.data = NULL; sset->start.len = ndims; @@ -1717,7 +1717,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if (!sset->stride.data) { if (ndims > 0) - sset->stride.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->stride.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); else sset->stride.data = NULL; sset->stride.len = ndims; @@ -1727,7 +1727,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if (!sset->count.data) { if (ndims > 0) - sset->count.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->count.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); else sset->count.data = NULL; sset->count.len = ndims; @@ -1737,7 +1737,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if (!sset->block.data) { if (ndims > 0) - sset->block.data = (hsize_t *)HDcalloc((size_t)ndims, sizeof(hsize_t)); + sset->block.data = (hsize_t *)calloc((size_t)ndims, sizeof(hsize_t)); else sset->block.data = NULL; sset->block.len = ndims; @@ -1856,7 +1856,7 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c if (prefix_len <= new_len) { prefix_len = new_len; - prefix = (char *)HDrealloc(prefix, prefix_len); + prefix = (char *)realloc(prefix, prefix_len); } /* end if */ HDstrcpy(prefix, group); @@ -1893,7 +1893,7 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATT h5tools_setstatus(EXIT_FAILURE); } else { - char *buf = (char *)HDmalloc(linfo.u.val_size); + char *buf = (char *)malloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); switch (linfo.type) { @@ -1951,7 +1951,7 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED *data, int H5_ATT end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); break; } /* end switch */ - HDfree(buf); + free(buf); } /* end else */ } diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 80f9142..485d6f6 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -165,7 +165,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 outputformat = &string_dataformat; /* Build the object's path name */ - obj_path = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + obj_path = (char *)malloc(HDstrlen(prefix) + HDstrlen(name) + 2); if (!obj_path) { ret = FAIL; goto done; @@ -211,7 +211,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 /* Restore old prefix name */ HDstrcpy(prefix, old_prefix); - HDfree(old_prefix); + free(old_prefix); } /* Close group */ @@ -316,10 +316,10 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_name); - HDfree(t_obj_path); - HDfree(t_prefix); - HDfree(t_objname); + free(t_name); + free(t_obj_path); + free(t_prefix); + free(t_objname); H5Dclose(obj); goto done; @@ -364,7 +364,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 switch (linfo->type) { case H5L_TYPE_SOFT: - if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + if ((targbuf = (char *)malloc(linfo->u.val_size)) == NULL) { error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -388,7 +388,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 char *t_link_path; int res; - t_link_path = (char *)HDmalloc(HDstrlen(prefix) + linfo->u.val_size + 1); + t_link_path = (char *)malloc(HDstrlen(prefix) + linfo->u.val_size + 1); if (targbuf[0] == '/') HDstrcpy(t_link_path, targbuf); else { @@ -446,19 +446,19 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); } - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_targbuf); - HDfree(t_obj_path); - HDfree(t_link_path); + free(t_prefix); + free(t_name); + free(t_targbuf); + free(t_obj_path); + free(t_link_path); } - HDfree(targbuf); + free(targbuf); } break; case H5L_TYPE_EXTERNAL: - if ((targbuf = (char *)HDmalloc(linfo->u.val_size)) == NULL) { + if ((targbuf = (char *)malloc(linfo->u.val_size)) == NULL) { error_msg("unable to allocate buffer\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -512,14 +512,14 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); - HDfree(t_obj_path); + free(t_prefix); + free(t_name); + free(t_filename); + free(t_targname); + free(t_obj_path); } /* end else */ } /* end else */ - HDfree(targbuf); + free(targbuf); } break; @@ -556,9 +556,9 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5 h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); + free(t_prefix); + free(t_name); + free(t_obj_path); } break; } /* end switch */ @@ -569,7 +569,7 @@ done: h5tools_str_close(&buffer); if (obj_path) - HDfree(obj_path); + free(obj_path); return ret; } @@ -689,7 +689,7 @@ xml_escape_the_name(const char *str) cp = str; ncp_len = len + extra + 1; - rcp = ncp = (char *)HDmalloc(ncp_len); + rcp = ncp = (char *)malloc(ncp_len); if (!ncp) return NULL; /* ?? */ @@ -782,7 +782,7 @@ xml_escape_the_string(const char *str, int slen) cp = str; ncp_len = len + extra + 1; - rcp = ncp = (char *)HDcalloc(ncp_len, sizeof(char)); + rcp = ncp = (char *)calloc(ncp_len, sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -912,7 +912,7 @@ xml_print_datatype(hid_t type, unsigned in_group) /* This should be defined somewhere else */ /* These 2 cases are handled the same right now, but probably will have something different eventually */ - char *dtxid = (char *)HDmalloc((size_t)100); + char *dtxid = (char *)malloc((size_t)100); xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -939,9 +939,9 @@ xml_print_datatype(hid_t type, unsigned in_group) dtxid, t_objname); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_objname); + free(t_objname); } - HDfree(dtxid); + free(dtxid); } else { ctx.need_prefix = TRUE; @@ -1286,7 +1286,7 @@ xml_print_datatype(hid_t type, unsigned in_group) (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); H5free_memory(mname); - HDfree(t_fname); + free(t_fname); dump_indent += COL; ctx.indent_level++; @@ -1612,7 +1612,7 @@ xml_dump_datatype(hid_t type) if (found_obj) { /* Shared datatype, must be entered as an object */ /* These 2 cases are the same now, but may change */ - char *dtxid = (char *)HDmalloc((size_t)100); + char *dtxid = (char *)malloc((size_t)100); xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1); if (!found_obj->recorded) { @@ -1642,9 +1642,9 @@ xml_dump_datatype(hid_t type) xmlnsprefix, dtxid, t_objname); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_objname); + free(t_objname); } - HDfree(dtxid); + free(dtxid); } else { ctx.need_prefix = TRUE; @@ -2081,7 +2081,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED h5tools_str_append(&buffer, "<%sAttribute Name=\"%s\">", xmlnsprefix, t_aname); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_aname); + free(t_aname); if ((attr_id = H5Aopen(attr, attr_name, H5P_DEFAULT)) >= 0) { type = H5Aget_type(attr_id); @@ -2370,7 +2370,7 @@ xml_dump_named_datatype(hid_t type, const char *name) char *t_prefix = NULL; char *t_name = NULL; - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)malloc(HDstrlen(prefix) + HDstrlen(name) + 2); if (tmp == NULL) { indentation(dump_indent); error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); @@ -2406,8 +2406,8 @@ xml_dump_named_datatype(hid_t type, const char *name) string_dataformat.do_escape = dump_opts.display_escape; outputformat = &string_dataformat; - dtxid = (char *)HDmalloc((size_t)100); - parentxid = (char *)HDmalloc((size_t)100); + dtxid = (char *)malloc((size_t)100); + parentxid = (char *)malloc((size_t)100); t_tmp = xml_escape_the_name(tmp); t_prefix = xml_escape_the_name(prefix); t_name = xml_escape_the_name(name); @@ -2493,7 +2493,7 @@ xml_dump_named_datatype(hid_t type, const char *name) h5tools_str_append(&buffer, "</%sNamedDataType>", xmlnsprefix); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_objname); + free(t_objname); goto done; } else @@ -2541,12 +2541,12 @@ done: h5tools_str_close(&buffer); - HDfree(dtxid); - HDfree(parentxid); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(t_name); - HDfree(tmp); + free(dtxid); + free(parentxid); + free(t_tmp); + free(t_prefix); + free(t_name); + free(tmp); } /*------------------------------------------------------------------------- @@ -2631,7 +2631,7 @@ xml_dump_group(hid_t gid, const char *name) tmp = HDstrdup("/"); } else { - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)malloc(HDstrlen(prefix) + HDstrlen(name) + 2); if (tmp == NULL) { indentation(dump_indent); error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__); @@ -2665,11 +2665,11 @@ xml_dump_group(hid_t gid, const char *name) } else { char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc((size_t)100); - char *parentxid = (char *)HDmalloc((size_t)100); + char *grpxid = (char *)malloc((size_t)100); + char *parentxid = (char *)malloc((size_t)100); if (found_obj->displayed) { - char *ptrstr = (char *)HDmalloc((size_t)100); + char *ptrstr = (char *)malloc((size_t)100); /* already seen: enter a groupptr */ if (isRoot) { @@ -2702,8 +2702,8 @@ xml_dump_group(hid_t gid, const char *name) par_name); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_objname); - HDfree(par_name); + free(t_objname); + free(par_name); ctx.indent_level++; @@ -2725,10 +2725,10 @@ xml_dump_group(hid_t gid, const char *name) ctx.indent_level--; - HDfree(t_objname); - HDfree(par_name); + free(t_objname); + free(par_name); } - HDfree(ptrstr); + free(ptrstr); } else { @@ -2763,8 +2763,8 @@ xml_dump_group(hid_t gid, const char *name) h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_tmp); - HDfree(par_name); + free(t_tmp); + free(par_name); } found_obj->displayed = TRUE; @@ -2820,16 +2820,16 @@ xml_dump_group(hid_t gid, const char *name) dump_indent -= COL; ctx.indent_level--; } - HDfree(t_name); - HDfree(grpxid); - HDfree(parentxid); + free(t_name); + free(grpxid); + free(parentxid); } } else { /* only link -- must be first time! */ char *t_name = xml_escape_the_name(name); - char *grpxid = (char *)HDmalloc((size_t)100); - char *parentxid = (char *)HDmalloc((size_t)100); + char *grpxid = (char *)malloc((size_t)100); + char *parentxid = (char *)malloc((size_t)100); ctx.need_prefix = TRUE; @@ -2851,15 +2851,15 @@ xml_dump_group(hid_t gid, const char *name) "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >", xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name); - HDfree(t_tmp); - HDfree(par_name); + free(t_tmp); + free(par_name); } h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_name); - HDfree(grpxid); - HDfree(parentxid); + free(t_name); + free(grpxid); + free(parentxid); /* 1. do all the attributes of the group */ @@ -2928,9 +2928,9 @@ xml_dump_group(hid_t gid, const char *name) h5tools_str_close(&buffer); if (par) - HDfree(par); + free(par); if (tmp) - HDfree(tmp); + free(tmp); } /*------------------------------------------------------------------------- @@ -2983,7 +2983,7 @@ xml_print_refs(hid_t did, int source) if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - buf = (char *)HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); + buf = (char *)calloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); @@ -2996,7 +2996,7 @@ xml_print_refs(hid_t did, int source) if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0) goto error; - buf = (char *)HDcalloc((size_t)ssiz, sizeof(H5R_ref_t)); + buf = (char *)calloc((size_t)ssiz, sizeof(H5R_ref_t)); if (buf == NULL) goto error; e = H5Aread(did, H5T_STD_REF, buf); @@ -3054,7 +3054,7 @@ xml_print_refs(hid_t did, int source) h5tools_str_append(&buffer, "\"%s\"", t_path); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_path); + free(t_path); } ctx.indent_level--; @@ -3065,14 +3065,14 @@ xml_print_refs(hid_t did, int source) h5tools_str_close(&buffer); - HDfree(buf); + free(buf); H5Tclose(type); H5Sclose(space); return SUCCEED; error: if (buf) - HDfree(buf); + free(buf); H5E_BEGIN_TRY { @@ -3133,7 +3133,7 @@ xml_print_strs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = HDmalloc((size_t)ssiz * tsiz); + buf = malloc((size_t)ssiz * tsiz); if (buf == NULL) goto error; @@ -3148,7 +3148,7 @@ xml_print_strs(hid_t did, int source) if ((tsiz = H5Tget_size(type)) == 0) goto error; - buf = HDmalloc((size_t)ssiz * tsiz); + buf = malloc((size_t)ssiz * tsiz); if (buf == NULL) goto error; @@ -3159,7 +3159,7 @@ xml_print_strs(hid_t did, int source) bp = (char *)buf; if (!is_vlstr) { - onestring = (char *)HDcalloc(tsiz, sizeof(char)); + onestring = (char *)calloc(tsiz, sizeof(char)); if (onestring == NULL) goto error; } @@ -3219,7 +3219,7 @@ xml_print_strs(hid_t did, int source) h5tools_str_append(&buffer, "\"%s\"", t_onestring); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_onestring); + free(t_onestring); } } bp += tsiz; @@ -3230,11 +3230,11 @@ xml_print_strs(hid_t did, int source) /* Reclaim any VL memory, if necessary */ if (!is_vlstr) if (onestring) - HDfree(onestring); + free(onestring); if (buf) { if (is_vlstr) H5Treclaim(type, space, H5P_DEFAULT, buf); - HDfree(buf); + free(buf); } H5Tclose(type); H5Sclose(space); @@ -3242,7 +3242,7 @@ xml_print_strs(hid_t did, int source) error: if (buf) - HDfree(buf); + free(buf); H5E_BEGIN_TRY { @@ -3459,7 +3459,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) dump_indent += COL; space = H5Tget_size(type); - buf = HDmalloc((size_t)space); + buf = malloc((size_t)space); H5Pget_fill_value(dcpl, type, buf); @@ -3492,7 +3492,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) h5tools_str_append(&buffer, "\"%s\"", t_path); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_path); + free(t_path); } ctx.need_prefix = TRUE; @@ -3732,7 +3732,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) break; } } - HDfree(buf); + free(buf); ctx.indent_level--; dump_indent -= COL; @@ -3782,15 +3782,15 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss h5tool_format_t string_dataformat; hsize_t curr_pos = 0; /* total data element position */ - char *rstr = (char *)HDmalloc((size_t)100); - char *pstr = (char *)HDmalloc((size_t)100); + char *rstr = (char *)malloc((size_t)100); + char *pstr = (char *)malloc((size_t)100); - tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); + tmp = (char *)malloc(HDstrlen(prefix) + HDstrlen(name) + 2); if (tmp == NULL) { error_msg("buffer allocation failed\n"); h5tools_setstatus(EXIT_FAILURE); - HDfree(rstr); - HDfree(pstr); + free(rstr); + free(pstr); return; } @@ -3839,12 +3839,12 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_name); - HDfree(t_tmp); - HDfree(t_prefix); - HDfree(rstr); - HDfree(pstr); - HDfree(tmp); + free(t_name); + free(t_tmp); + free(t_prefix); + free(rstr); + free(pstr); + free(tmp); dcpl = H5Dget_create_plist(did); type = H5Dget_type(did); @@ -3860,7 +3860,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss h5tools_setstatus(EXIT_FAILURE); } else { - chsize = (hsize_t *)HDmalloc((size_t)maxdims * sizeof(hsize_t)); + chsize = (hsize_t *)malloc((size_t)maxdims * sizeof(hsize_t)); ctx.indent_level++; dump_indent += COL; @@ -3943,7 +3943,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); ctx.indent_level--; dump_indent -= COL; - HDfree(chsize); + free(chsize); } } else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl)) { @@ -4457,8 +4457,8 @@ xml_print_enum(hid_t type) } /* Get the names and raw values of all members */ - name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); - value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); + name = (char **)calloc((size_t)nmembs, sizeof(char *)); + value = (unsigned char *)calloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < nmembs; i++) { name[i] = H5Tget_member_name(type, i); @@ -4494,7 +4494,7 @@ xml_print_enum(hid_t type) h5tools_str_append(&buffer, "%s", t_name); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - HDfree(t_name); + free(t_name); ctx.indent_level--; ctx.need_prefix = TRUE; @@ -4557,7 +4557,7 @@ xml_print_enum(hid_t type) for (i = 0; i < nmembs; i++) H5free_memory(name[i]); - HDfree(name); - HDfree(value); + free(name); + free(value); H5Tclose(super); } diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index ac98b25..648b9a8 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -453,9 +453,9 @@ done: } /* end if */ if (fname_g) - HDfree(fname_g); + free(fname_g); if (dname_g) - HDfree(dname_g); + free(dname_g); leave(h5tools_getstatus()); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 05f51e4..d6273e2 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -101,7 +101,7 @@ main(int argc, char *argv[]) (void)HDsetvbuf(stderr, (char *)NULL, _IOLBF, 0); (void)HDsetvbuf(stdout, (char *)NULL, _IOLBF, 0); - if ((opt = (struct Options *)HDcalloc(1, sizeof(struct Options))) == NULL) + if ((opt = (struct Options *)calloc(1, sizeof(struct Options))) == NULL) goto err; if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) { @@ -242,17 +242,17 @@ main(int argc, char *argv[]) for (i = 0; i < opt->fcount; i++) { in = &(opt->infiles[i].in); if (in->sizeOfDimension) - HDfree(in->sizeOfDimension); + free(in->sizeOfDimension); if (in->sizeOfChunk) - HDfree(in->sizeOfChunk); + free(in->sizeOfChunk); if (in->maxsizeOfDimension) - HDfree(in->maxsizeOfDimension); + free(in->maxsizeOfDimension); if (in->externFilename) - HDfree(in->externFilename); + free(in->externFilename); if (in->data) - HDfree(in->data); + free(in->data); } - HDfree(opt); + free(opt); return EXIT_SUCCESS; err: @@ -260,17 +260,17 @@ err: for (i = 0; i < opt->fcount; i++) { in = &(opt->infiles[i].in); if (in->sizeOfDimension) - HDfree(in->sizeOfDimension); + free(in->sizeOfDimension); if (in->sizeOfChunk) - HDfree(in->sizeOfChunk); + free(in->sizeOfChunk); if (in->maxsizeOfDimension) - HDfree(in->maxsizeOfDimension); + free(in->maxsizeOfDimension); if (in->externFilename) - HDfree(in->externFilename); + free(in->externFilename); if (in->data) - HDfree(in->data); + free(in->data); } - HDfree(opt); + free(opt); return EXIT_FAILURE; } @@ -1267,28 +1267,28 @@ allocateIntegerStorage(struct Input *in) switch (in->inputSize) { case 8: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT8))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_INT8))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 16: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT16))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_INT16))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 32: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT32))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_INT32))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 64: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_INT64))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_INT64))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -1314,28 +1314,28 @@ allocateUIntegerStorage(struct Input *in) switch (in->inputSize) { case 8: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT8))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_UINT8))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 16: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT16))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_UINT16))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 32: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT32))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_UINT32))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 64: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_UINT64))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_UINT64))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -1361,14 +1361,14 @@ allocateFloatStorage(struct Input *in) switch (in->inputSize) { case 32: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT32))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_FLOAT32))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } break; case 64: - if ((in->data = (VOIDP)HDmalloc((size_t)len * sizeof(H5DT_FLOAT64))) == NULL) { + if ((in->data = (VOIDP)malloc((size_t)len * sizeof(H5DT_FLOAT64))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -1691,7 +1691,7 @@ processConfigurationFile(char *infile, struct Input *in) } } /* while (get_next_dim) */ - if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == + if ((in->sizeOfDimension = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { goto error; } @@ -1723,7 +1723,7 @@ processConfigurationFile(char *infile, struct Input *in) #endif if (!HDstrcmp("/", temp)) { /* / max dims */ if ((in->maxsizeOfDimension = - (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { goto error; } if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ @@ -1821,7 +1821,7 @@ processConfigurationFile(char *infile, struct Input *in) printf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif if (!HDstrcmp("CHUNKED", temp)) { /* CHUNKED */ - if ((in->sizeOfChunk = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + if ((in->sizeOfChunk = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { (void)fprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } @@ -2565,7 +2565,7 @@ parseDimensions(struct Input *in, char *strm) i++; } in->rank = i + 1; - if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + if ((in->sizeOfDimension = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -3536,7 +3536,7 @@ getDimensionSizes(struct Input *in, FILE *strm) const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n"; - if ((in->sizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + if ((in->sizeOfDimension = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -3562,7 +3562,7 @@ getChunkedDimensionSizes(struct Input *in, FILE *strm) "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n"; const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n"; - if ((in->sizeOfChunk = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + if ((in->sizeOfChunk = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -3595,7 +3595,7 @@ getMaximumDimensionSizes(struct Input *in, FILE *strm) const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: " "can be -1 to indicate unlimited size\n"; - if ((in->maxsizeOfDimension = (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { + if ((in->maxsizeOfDimension = (hsize_t *)malloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { (void)fprintf(stderr, "%s", err1); return (-1); } @@ -3769,7 +3769,7 @@ getExternalFilename(struct Input *in, FILE *strm) } temp_len = HDstrlen(temp); - in->externFilename = (char *)HDmalloc((temp_len + 1) * sizeof(char)); + in->externFilename = (char *)malloc((temp_len + 1) * sizeof(char)); (void)HDstrcpy(in->externFilename, temp); in->externFilename[temp_len] = '\0'; return (0); diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index 2da104e..91eb937 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -330,11 +330,11 @@ main(int argc, char *argv[]) done: if (ub_file) - HDfree(ub_file); + free(ub_file); if (input_file) - HDfree(input_file); + free(input_file); if (output_file) - HDfree(output_file); + free(output_file); if (plist >= 0) H5Pclose(plist); diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index 1cda5d4..34c817d 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -143,11 +143,11 @@ parse_command_line(int argc, const char *const *argv) done: if (input_file) - HDfree(input_file); + free(input_file); if (output_file) - HDfree(output_file); + free(output_file); if (ub_file) - HDfree(ub_file); + free(ub_file); return EXIT_FAILURE; } @@ -281,13 +281,13 @@ main(int argc, char *argv[]) done: if (input_file) - HDfree(input_file); + free(input_file); if (output_file) - HDfree(output_file); + free(output_file); if (ub_file) { - HDfree(ub_file); + free(ub_file); } leave(h5tools_getstatus()); diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 54c527a..219abfd 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -921,8 +921,8 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) dst_size = H5Tget_size(type); /* Get the names and raw values of all members */ - name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); - value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); + name = (char **)calloc((size_t)nmembs, sizeof(char *)); + value = (unsigned char *)calloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); for (i = 0; i < (unsigned)nmembs; i++) { name[i] = H5Tget_member_name(type, i); H5Tget_member_value(type, i, value + i * H5Tget_size(type)); @@ -934,8 +934,8 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /* Release resources */ for (i = 0; i < (unsigned)nmembs; i++) H5free_memory(name[i]); - HDfree(name); - HDfree(value); + free(name); + free(value); H5Tclose(super); return FALSE; @@ -976,8 +976,8 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /* Release resources */ for (i = 0; i < (unsigned)nmembs; i++) H5free_memory(name[i]); - HDfree(name); - HDfree(value); + free(name); + free(value); } else h5tools_str_append(buffer, "\n%*s <empty>", ind + 4, ""); @@ -1183,7 +1183,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { - dims = (hsize_t *)HDmalloc((unsigned)ndims * sizeof(dims[0])); + dims = (hsize_t *)malloc((unsigned)ndims * sizeof(dims[0])); H5Tget_array_dims2(type, dims); /* Print dimensions */ @@ -1191,7 +1191,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "%s%" PRIuHSIZE, i ? "," : "[", dims[i]); h5tools_str_append(buffer, "]"); - HDfree(dims); + free(dims); } else h5tools_str_append(buffer, " [SCALAR]\n"); @@ -1436,17 +1436,17 @@ dump_dataset_values(hid_t dset) ctx.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))) { H5TOOLS_DEBUG("H5Dread reference read"); if (H5Dread(dset, 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(); } h5tools_dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims); PRINTVALSTREAM(rawoutstream, "\n"); - HDfree(ref_buf); + free(ref_buf); } } else { @@ -1606,10 +1606,10 @@ dump_attribute_values(hid_t attr) ctx.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))) { H5TOOLS_DEBUG("H5Aread reference read"); if (H5Aread(attr, H5T_STD_REF, ref_buf) < 0) { - HDfree(ref_buf); + free(ref_buf); H5TOOLS_INFO("H5Aread reference failed"); H5TOOLS_GOTO_DONE_NO_RET(); } @@ -1618,7 +1618,7 @@ dump_attribute_values(hid_t attr) PRINTVALSTREAM(rawoutstream, "\n"); ctx.indent_level--; - HDfree(ref_buf); + free(ref_buf); } } else { @@ -2208,7 +2208,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi */ if (cmt_bufsize > 0) { comment = - (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */ + (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) { @@ -2220,7 +2220,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } /* end if */ - HDfree(comment); + free(comment); } } } @@ -2434,7 +2434,7 @@ done: h5tools_str_close(&buffer); if (buf) - HDfree(buf); + free(buf); return 0; } /* end list_lnk() */ @@ -3049,7 +3049,7 @@ main(int argc, char *argv[]) if (file_id < 0) { fprintf(rawerrorstream, "%s: unable to open file\n", argv[argno - 1]); - HDfree(fname); + free(fname); err_exit = 1; continue; } /* end if */ @@ -3126,17 +3126,17 @@ main(int argc, char *argv[]) list_lnk(oname, &li, &iter); } H5Fclose(file_id); - HDfree(fname); + free(fname); if (x) - HDfree(oname); + free(oname); for (u = 0; u < symlink_list.nused; u++) { if (symlink_list.objs[u].type == H5L_TYPE_EXTERNAL) - HDfree(symlink_list.objs[u].file); + free(symlink_list.objs[u].file); - HDfree(symlink_list.objs[u].path); + free(symlink_list.objs[u].path); } - HDfree(symlink_list.objs); + free(symlink_list.objs); /* if no-dangling-links option specified and dangling link found */ if (no_dangling_link_g && iter.symlink_list->dangle_link) diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index e6f0834..cbe9a17 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -166,7 +166,7 @@ do_pio(parameters param) /* IO type */ iot = param.io_type; - if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char)))) + if (NULL == (fname = calloc(FILENAME_MAX, sizeof(char)))) GOTOERROR(FAIL); switch (iot) { @@ -366,8 +366,8 @@ done: } /* release generic resources */ - HDfree(buffer); - HDfree(fname); + free(buffer); + free(fname); res.ret_code = ret_code; return res; } diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 393a250..3be19f8 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -763,7 +763,7 @@ h5_set_info_object(void) /* copy key/value pair into temporary buffer */ len = strcspn(valp, ";"); next = &valp[len]; - key_val = (char *)HDcalloc(1, len + 1); + key_val = (char *)calloc(1, len + 1); /* increment the next pointer past the terminating semicolon */ if (*next == ';') @@ -811,10 +811,10 @@ h5_set_info_object(void) } valp = next; - HDfree(key_val); + free(key_val); } while (next && *next); - HDfree(envp); + free(envp); } return ret_value; @@ -1432,7 +1432,7 @@ parse_command_line(int argc, const char *const *argv) case '?': default: usage(progname); - HDfree(cl_opts); + free(cl_opts); return NULL; } } diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index 24c3f06..9fbe9eb 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -144,7 +144,7 @@ do_sio(parameters param, results *res) /* IO type */ iot = param.io_type; - if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char)))) + if (NULL == (fname = calloc(FILENAME_MAX, sizeof(char)))) GOTOERROR(FAIL); switch (iot) { @@ -268,8 +268,8 @@ done: } /* release generic resources */ - HDfree(buffer); - HDfree(fname); + free(buffer); + free(fname); res->ret_code = ret_code; } @@ -1169,7 +1169,7 @@ set_vfd(parameters *param) assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - if (NULL == (sv = HDcalloc(1, sizeof(*sv)))) + if (NULL == (sv = calloc(1, sizeof(*sv)))) return -1; for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; @@ -1179,11 +1179,11 @@ set_vfd(parameters *param) } if (H5Pset_fapl_multi(my_fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) { - HDfree(sv); + free(sv); return -1; } - HDfree(sv); + free(sv); } else if (vfd == family) { hsize_t fam_size = 1 * 1024 * 1024; /*100 MB*/ @@ -1271,7 +1271,7 @@ do_cleanupfile(iotype iot, char *filename) hid_t driver; temp_sz = (4096 + sizeof("-?.h5")) * sizeof(char); - if (NULL == (temp = HDcalloc(1, temp_sz))) + if (NULL == (temp = calloc(1, temp_sz))) goto done; if (clean_file_g == -1) @@ -1332,5 +1332,5 @@ do_cleanupfile(iotype iot, char *filename) } done: - HDfree(temp); + free(temp); } diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 5d88cd2..a991e19 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -214,7 +214,7 @@ main(int argc, char *argv[]) run_test_loop(opts); finish: - HDfree(opts); + free(opts); return exit_value; } @@ -500,16 +500,16 @@ run_test(iotype iot, parameters parms, struct options *opts) } /* clean up our mess */ - HDfree(write_sys_mm_table); - HDfree(write_mm_table); - HDfree(write_gross_mm_table); - HDfree(write_raw_mm_table); + free(write_sys_mm_table); + free(write_mm_table); + free(write_gross_mm_table); + free(write_raw_mm_table); if (!parms.h5_write_only) { - HDfree(read_sys_mm_table); - HDfree(read_mm_table); - HDfree(read_gross_mm_table); - HDfree(read_raw_mm_table); + free(read_sys_mm_table); + free(read_mm_table); + free(read_gross_mm_table); + free(read_raw_mm_table); } return ret_value; @@ -809,7 +809,7 @@ parse_command_line(int argc, const char *const *argv) struct options *cl_opts; int i, default_rank, actual_rank, ranks[4]; - cl_opts = (struct options *)HDmalloc(sizeof(struct options)); + cl_opts = (struct options *)malloc(sizeof(struct options)); cl_opts->page_buffer_size = 0; cl_opts->page_size = 0; @@ -1103,7 +1103,7 @@ parse_command_line(int argc, const char *const *argv) case '?': default: usage(progname); - HDfree(cl_opts); + free(cl_opts); return NULL; } } diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 5c95b06..a6d83ea 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -132,7 +132,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) n = options->n_filter_g++; /* increase # of global filters */ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); + free(obj_list); return -1; } @@ -141,7 +141,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) else options_add_filter(obj_list, n_objs, filter, options->op_tbl); - HDfree(obj_list); + free(obj_list); return 0; } /* end h5repack_addfilter() */ @@ -195,7 +195,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options) if (options->all_layout == 0) ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - HDfree(obj_list); + free(obj_list); ret_value = 0; } /* end if obj_list exists */ @@ -253,7 +253,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t for (i = 0; i < travt->nobjs; i++) { if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ - if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; @@ -276,7 +276,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t */ if (!dt_ret) { /* Push the new datatype onto the stack */ - if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt_ret = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt_ret->next = *named_dt_head_p; *named_dt_head_p = dt_ret; @@ -330,7 +330,7 @@ named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) if (H5Tclose(dt->id_out) < 0 && !ignore_err) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); dt = dt->next; - HDfree(*named_dt_head_p); + free(*named_dt_head_p); *named_dt_head_p = dt; } @@ -481,9 +481,9 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ *----------------------------------------------------------------- */ - buf = (void *)HDmalloc((size_t)(nelmts * msize)); + buf = (void *)malloc((size_t)(nelmts * msize)); if (buf == NULL) { - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (options->verbose == 2) { H5_timer_init(&timer); @@ -526,7 +526,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ if (TRUE == h5tools_detect_vlen(wtype_id)) H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); - HDfree(buf); + free(buf); buf = NULL; } /*H5T_REFERENCE*/ @@ -566,7 +566,7 @@ done: H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); /* Free buf */ - HDfree(buf); + free(buf); } H5Aclose(attr_out); diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 8b11974..be3fddf 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1012,7 +1012,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* have to read the whole dataset if there is only one element in the * dataset */ if (need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); + buf = malloc(need); /* Set up collective write if using filters in parallel */ { @@ -1061,7 +1061,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ - HDfree(buf); + free(buf); buf = NULL; } } @@ -1108,7 +1108,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti &hslab_nbytes) < 0) H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed"); - hslab_buf = HDmalloc((size_t)hslab_nbytes); + hslab_buf = malloc((size_t)hslab_nbytes); if (hslab_buf == NULL) H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab"); @@ -1189,7 +1189,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5Sclose(hslab_space); if (hslab_buf != NULL) { - HDfree(hslab_buf); + free(hslab_buf); hslab_buf = NULL; } } /* end if reading/writing by hyperslab */ @@ -1421,7 +1421,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); linkinfo.trg_path = NULL; } /* options->merge */ else { @@ -1460,7 +1460,7 @@ done: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); H5E_BEGIN_TRY { @@ -1484,9 +1484,9 @@ done: /* free */ if (buf != NULL) - HDfree(buf); + free(buf); if (hslab_buf != NULL) - HDfree(hslab_buf); + free(hslab_buf); return ret_value; } /* end do_copy_objects() */ diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 4e6e0f4..64f3011 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -104,7 +104,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) int ret_value = 0; table->size += n_objs; - table->objs = (pack_info_t *)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + table->objs = (pack_info_t *)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { H5TOOLS_INFO("not enough memory for options table"); ret_value = -1; @@ -132,14 +132,14 @@ options_table_init(pack_opttbl_t **tbl) pack_opttbl_t *table; int ret_value = 0; - if (NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) { + if (NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) { H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } table->size = 30; table->nelems = 0; - if (NULL == (table->objs = (pack_info_t *)HDmalloc(table->size * sizeof(pack_info_t)))) { - HDfree(table); + if (NULL == (table->objs = (pack_info_t *)malloc(table->size * sizeof(pack_info_t)))) { + free(table); H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } @@ -163,8 +163,8 @@ done: int options_table_free(pack_opttbl_t *table) { - HDfree(table->objs); - HDfree(table); + free(table->objs); + free(table); return 0; } diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index cee85ac..d4fa990 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -77,7 +77,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t else *n_objs = n; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -103,7 +103,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("input Error: Invalid compression type in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -134,7 +134,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter not digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -184,7 +184,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -244,13 +244,13 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter number parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } else if (!HDisdigit(c) && f == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter flag parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -269,7 +269,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -312,7 +312,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 1; if (no_param) { /*no more parameters, GZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -327,7 +327,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -342,7 +342,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in SHUF <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -356,7 +356,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in FLET <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -370,7 +370,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*nbit does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in NBIT <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -384,7 +384,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SOFF must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -397,14 +397,14 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* parameters does not match count */ if (filt->cd_nelmts != j) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("incorrect number of compression parameters in <%s>\n", str); HDexit(EXIT_FAILURE); } } else { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid filter type in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -425,7 +425,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t case H5Z_FILTER_DEFLATE: if (filt->cd_values[0] > 9) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -438,19 +438,19 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t pixels_per_block = filt->cd_values[0]; if ((pixels_per_block % 2) == 1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is not even in <%s>\n", str); HDexit(EXIT_FAILURE); } if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is too large in <%s>\n", str); HDexit(EXIT_FAILURE); } if ((HDstrcmp(smask, "NN") != 0) && (HDstrcmp(smask, "EC") != 0)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); HDexit(EXIT_FAILURE); } @@ -514,7 +514,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about } n++; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -541,7 +541,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, no characters after : in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -575,7 +575,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about k = 0; if (j > len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n", str); HDexit(EXIT_FAILURE); } @@ -587,7 +587,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } @@ -599,7 +599,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } @@ -615,7 +615,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a9a5fd3..222447d 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -152,19 +152,19 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (u = 0; u < nelmts; u++) { H5E_BEGIN_TRY { @@ -207,9 +207,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*------------------------------------------------------ * copy attrs @@ -234,11 +234,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); @@ -246,12 +246,12 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti * create output *------------------------------------------------------------------------- */ - refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), - (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), + (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (u = 0; u < nelmts; u++) { H5E_BEGIN_TRY @@ -301,9 +301,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*----------------------------------------------------- * copy attrs @@ -506,8 +506,8 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nmembers < 1) H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed"); - ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers * sizeof(unsigned)); - ref_comp_size = (size_t *)HDmalloc((size_t)nmembers * sizeof(ref_comp_size)); + ref_comp_index = (unsigned *)malloc((size_t)nmembers * sizeof(unsigned)); + ref_comp_size = (size_t *)malloc((size_t)nmembers * sizeof(ref_comp_size)); ref_comp_field_n = 0; for (i = 0; i < (unsigned)nmembers; i++) { @@ -527,12 +527,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * statement below. */ if (!ref_comp_field_n) { if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } } @@ -598,19 +598,19 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nelmts > 0) { /* handle object references */ if ((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE == msize)) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (i = 0; i < (unsigned)nelmts; i++) if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, @@ -619,12 +619,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / } /* H5T_STD_REF_OBJ */ /* handle region references */ else if ((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -632,12 +632,11 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * create output *------------------------------------------------------------------------- */ - refbuf = - (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (i = 0; i < (unsigned)nelmts; i++) if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, @@ -647,13 +646,13 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_vlen) { /* handle VLEN of references */ - buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); + buf = (hvl_t *)malloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -689,13 +688,13 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_comp) { /* handle ref fields in a compound */ - buf = HDmalloc((unsigned)(nelmts * msize)); + buf = malloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -739,22 +738,22 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if (buf) { - HDfree(buf); + free(buf); buf = NULL; } if (refbuf) { - HDfree(refbuf); + free(refbuf); refbuf = NULL; } if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } @@ -777,15 +776,15 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / done: if (refbuf) - HDfree(refbuf); + free(refbuf); if (buf) - HDfree(buf); + free(buf); if (ref_comp_index) - HDfree(ref_comp_index); + free(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + free(ref_comp_size); H5E_BEGIN_TRY { diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 9da6ba2..23bde1a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -306,7 +306,7 @@ attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *na /* Add attribute count to proper bin */ bin = ceil_log10((unsigned long)oi->num_attrs); if ((bin + 1) > iter->attr_nbins) { - iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); + iter->attr_bins = (unsigned long *)realloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); assert(iter->attr_bins); /* Initialize counts for intermediate bins */ @@ -367,7 +367,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_nat if ((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ if ((iter->group_bins = - (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL) + (unsigned long *)realloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL) H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ @@ -502,8 +502,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_n bin = ceil_log10((unsigned long)dims[0]); if ((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ - if ((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, - (bin + 1) * sizeof(unsigned long))) == NULL) + if ((iter->dset_dim_bins = (unsigned long *)realloc(iter->dset_dim_bins, + (bin + 1) * sizeof(unsigned long))) == NULL) H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ @@ -541,7 +541,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_n iter->dset_ntypes++; /* Allocate more storage for info about dataset's datatype */ - if ((iter->dset_type_info = (dtype_info_t *)HDrealloc( + if ((iter->dset_type_info = (dtype_info_t *)realloc( iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL) H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); @@ -738,7 +738,7 @@ freespace_stats(hid_t fid, iter_t *iter) if ((nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, 0, NULL)) < 0) return (FAIL); else if (nsects) { - if (NULL == (sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)))) + if (NULL == (sect_info = (H5F_sect_info_t *)calloc((size_t)nsects, sizeof(H5F_sect_info_t)))) return (FAIL); nsects = H5Fget_free_sections(fid, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); assert(nsects); @@ -754,7 +754,7 @@ freespace_stats(hid_t fid, iter_t *iter) bin = ceil_log10((unsigned long)sect_info[u].size); if (bin >= iter->sect_nbins) { /* Allocate more storage for section info */ - iter->sect_bins = (unsigned long *)HDrealloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); + iter->sect_bins = (unsigned long *)realloc(iter->sect_bins, (bin + 1) * sizeof(unsigned long)); assert(iter->sect_bins); /* Initialize counts for intermediate bins */ @@ -770,7 +770,7 @@ freespace_stats(hid_t fid, iter_t *iter) } /* end for */ if (sect_info) - HDfree(sect_info); + free(sect_info); return 0; } /* end freespace_stats() */ @@ -794,12 +794,12 @@ hand_free(struct handler_t *hand) for (u = 0; u < hand->obj_count; u++) if (hand->obj[u]) { - HDfree(hand->obj[u]); + free(hand->obj[u]); hand->obj[u] = NULL; } /* end if */ hand->obj_count = 0; - HDfree(hand->obj); - HDfree(hand); + free(hand->obj); + free(hand); } /* end if */ } /* end hand_free() */ @@ -940,14 +940,14 @@ parse_command_line(int argc, const char *const *argv, struct handler_t **hand_re display_object = TRUE; /* Allocate space to hold the command line info */ - if (NULL == (hand = (struct handler_t *)HDcalloc((size_t)1, sizeof(struct handler_t)))) { + if (NULL == (hand = (struct handler_t *)calloc((size_t)1, sizeof(struct handler_t)))) { error_msg("unable to allocate memory for object struct\n"); goto error; } /* end if */ /* Allocate space to hold the object strings */ hand->obj_count = (size_t)argc; - if (NULL == (hand->obj = (char **)HDcalloc((size_t)argc, sizeof(char *)))) { + if (NULL == (hand->obj = (char **)calloc((size_t)argc, sizeof(char *)))) { error_msg("unable to allocate memory for object array\n"); goto error; } /* end if */ @@ -1031,49 +1031,49 @@ iter_free(iter_t *iter) /* Clear array of bins for group counts */ if (iter->group_bins) { - HDfree(iter->group_bins); + free(iter->group_bins); iter->group_bins = NULL; } /* end if */ /* Clear array for tracking small groups */ if (iter->num_small_groups) { - HDfree(iter->num_small_groups); + free(iter->num_small_groups); iter->num_small_groups = NULL; } /* end if */ /* Clear array of bins for attribute counts */ if (iter->attr_bins) { - HDfree(iter->attr_bins); + free(iter->attr_bins); iter->attr_bins = NULL; } /* end if */ /* Clear array for tracking small attributes */ if (iter->num_small_attrs) { - HDfree(iter->num_small_attrs); + free(iter->num_small_attrs); iter->num_small_attrs = NULL; } /* end if */ /* Clear dataset datatype information found */ if (iter->dset_type_info) { - HDfree(iter->dset_type_info); + free(iter->dset_type_info); iter->dset_type_info = NULL; } /* end if */ /* Clear array of bins for dataset dimensions */ if (iter->dset_dim_bins) { - HDfree(iter->dset_dim_bins); + free(iter->dset_dim_bins); iter->dset_dim_bins = NULL; } /* end if */ /* Clear array of tracking 1-D small datasets */ if (iter->small_dset_dims) { - HDfree(iter->small_dset_dims); + free(iter->small_dset_dims); iter->small_dset_dims = NULL; } /* end if */ /* Clear array of bins for free-space section sizes */ if (iter->sect_bins) { - HDfree(iter->sect_bins); + free(iter->sect_bins); iter->sect_bins = NULL; } /* end if */ } /* end iter_free() */ @@ -1732,10 +1732,9 @@ main(int argc, char *argv[]) iter.free_hdr = finfo.free.meta_size; } /* end else */ - iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long)); - iter.num_small_attrs = - (unsigned long *)HDcalloc((size_t)(sattrs_threshold + 1), sizeof(unsigned long)); - iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long)); + iter.num_small_groups = (unsigned long *)calloc((size_t)sgroups_threshold, sizeof(unsigned long)); + iter.num_small_attrs = (unsigned long *)calloc((size_t)(sattrs_threshold + 1), sizeof(unsigned long)); + iter.small_dset_dims = (unsigned long *)calloc((size_t)sdsets_threshold, sizeof(unsigned long)); if (iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index 5f26ef4..4a6029c 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -353,9 +353,9 @@ main(int argc, char *argv[]) done: if (fname) - HDfree(fname); + free(fname); if (fname_g) - HDfree(fname_g); + free(fname_g); H5E_BEGIN_TRY { diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index 98b6b76..a359db6 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -58,11 +58,11 @@ leave(int ret) size_t curr_group; if (params_g.fname) - HDfree(params_g.fname); + free(params_g.fname); if (params_g.ngroups) { for (curr_group = 0; curr_group < params_g.ngroups; curr_group++) - HDfree(params_g.groups[curr_group]); - HDfree(params_g.groups); + free(params_g.groups[curr_group]); + free(params_g.groups); } if (H5I_INVALID_HID != params_g.fapl_id && H5P_DEFAULT != params_g.fapl_id) if (H5Pclose(params_g.fapl_id) < 0) @@ -246,7 +246,7 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options) /* Allocate space for the group name pointers */ options->ngroups = (size_t)(argc - H5_optind); - options->groups = (char **)HDmalloc(options->ngroups * sizeof(char *)); + options->groups = (char **)malloc(options->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index c4ea0a6..843e9a3 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -226,9 +226,9 @@ main(int argc, char *argv[]) } /* end while */ /* allocate names */ - if (NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) + if (NULL == (src_name = (char *)calloc((size_t)NAMELEN, sizeof(char)))) HDexit(EXIT_FAILURE); - if (NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) + if (NULL == (dst_name = (char *)calloc((size_t)NAMELEN, sizeof(char)))) HDexit(EXIT_FAILURE); /* @@ -275,7 +275,7 @@ main(int argc, char *argv[]) usage(prog_name); /* Now the real work, split the file */ - buf = (char *)HDmalloc(blk_size); + buf = (char *)malloc(blk_size); while (src_offset < src_size) { /* Read a block. The amount to read is the minimum of: @@ -498,9 +498,9 @@ main(int argc, char *argv[]) } /* end if */ /* Free resources and return */ - HDfree(src_name); - HDfree(dst_name); - HDfree(buf); + free(src_name); + free(dst_name); + free(buf); return EXIT_SUCCESS; } /* end main */ H5_GCC_CLANG_DIAG_ON("format-nonliteral") diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 9fb5b74..899eaa7 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -238,10 +238,10 @@ gent_named_vl(hid_t loc_id) /* allocate and initialize VL dataset to write */ buf[0].len = 1; - buf[0].p = HDmalloc(1 * sizeof(int)); + buf[0].p = malloc(1 * sizeof(int)); ((int *)buf[0].p)[0] = 1; buf[1].len = 2; - buf[1].p = HDmalloc(2 * sizeof(int)); + buf[1].p = malloc(2 * sizeof(int)); ((int *)buf[1].p)[0] = 2; ((int *)buf[1].p)[1] = 3; @@ -284,16 +284,16 @@ gent_nested_vl(hid_t loc_id) /* allocate and initialize VL dataset to write */ buf[0].len = 1; - buf[0].p = HDmalloc(1 * sizeof(hvl_t)); + buf[0].p = malloc(1 * sizeof(hvl_t)); tvl = (hvl_t *)buf[0].p; - tvl->p = HDmalloc(1 * sizeof(int)); + tvl->p = malloc(1 * sizeof(int)); tvl->len = 1; ((int *)tvl->p)[0] = 1; buf[1].len = 1; - buf[1].p = HDmalloc(1 * sizeof(hvl_t)); + buf[1].p = malloc(1 * sizeof(hvl_t)); tvl = (hvl_t *)buf[1].p; - tvl->p = HDmalloc(2 * sizeof(int)); + tvl->p = malloc(2 * sizeof(int)); tvl->len = 2; ((int *)tvl->p)[0] = 2; ((int *)tvl->p)[1] = 3; diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 1700177..0c253d2 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -334,17 +334,17 @@ onion_filepaths_init(const char *basename) { struct onion_filepaths *paths = NULL; - if (NULL == (paths = HDcalloc(1, sizeof(struct onion_filepaths)))) + if (NULL == (paths = calloc(1, sizeof(struct onion_filepaths)))) goto error; if (NULL == (paths->canon = HDstrdup(basename))) goto error; - if (NULL == (paths->onion = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) + if (NULL == (paths->onion = malloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) goto error; HDsnprintf(paths->onion, ONION_TEST_FIXNAME_SIZE, "%s.onion", paths->canon); - if (NULL == (paths->recovery = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) + if (NULL == (paths->recovery = malloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) goto error; HDsnprintf(paths->recovery, ONION_TEST_FIXNAME_SIZE, "%s.onion.recovery", paths->canon); @@ -352,10 +352,10 @@ onion_filepaths_init(const char *basename) error: if (paths != NULL) { - HDfree(paths->canon); - HDfree(paths->onion); - HDfree(paths->recovery); - HDfree(paths); + free(paths->canon); + free(paths->onion); + free(paths->recovery); + free(paths); } return NULL; } @@ -364,10 +364,10 @@ static void onion_filepaths_destroy(struct onion_filepaths *s) { if (s) { - HDfree(s->canon); - HDfree(s->onion); - HDfree(s->recovery); - HDfree(s); + free(s->canon); + free(s->onion); + free(s->recovery); + free(s); } } @@ -5020,7 +5020,7 @@ test_comps_vlen(const char *fname, const char *dset, const char *attr, int diff, /* Allocate and initialize VL data to write */ for (i = 0; i < SDIM_DSET; i++) { wdata[i].i1 = (int)i; - wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); + wdata[i].vl.p = malloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; for (j = 0; j < (i + 1); j++) { ((cmpd2_t *)wdata[i].vl.p)[j].i2 = (int)(i * 10 + (unsigned)diff); @@ -5141,7 +5141,7 @@ test_comps_array_vlen(const char *fname, const char *dset, const char *attr, int /* Allocate and initialize VL data to write in compound2 */ for (j = 0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = (int)(j * 10); - wdata[i].cmpd2[j].vl.p = HDmalloc((j + 1) * sizeof(cmpd3_t)); + wdata[i].cmpd2[j].vl.p = malloc((j + 1) * sizeof(cmpd3_t)); wdata[i].cmpd2[j].vl.len = j + 1; for (k = 0; k < (j + 1); k++) { /* Initialize data of compound3 */ @@ -5280,7 +5280,7 @@ test_comps_vlen_arry(const char *fname, const char *dset, const char *attr, int for (i = 0; i < SDIM_DSET; i++) { /* compound 1 data */ wdata[i].i1 = (int)i; - wdata[i].vl.p = HDmalloc((i + 1) * sizeof(cmpd2_t)); + wdata[i].vl.p = malloc((i + 1) * sizeof(cmpd2_t)); wdata[i].vl.len = i + 1; for (j = 0; j < (i + 1); j++) { /* compound2 data */ @@ -6088,10 +6088,10 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -6349,7 +6349,7 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, n = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = malloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) @@ -6748,7 +6748,7 @@ write_attr_strings(hid_t loc_id, const char *dset_name, hid_t fid, for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) @@ -7074,10 +7074,10 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -7338,7 +7338,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, n = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = malloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) @@ -7738,7 +7738,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, hid_t fid, for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) @@ -8041,10 +8041,10 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -8091,7 +8091,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, /* allocate and initialize array data to write */ size = (H5TOOLS_MALLOCSIZE / sizeof(double) + 1) * sizeof(double); - dbuf = (double *)HDmalloc(size); + dbuf = (double *)malloc(size); for (jj = 0; jj < (H5TOOLS_MALLOCSIZE / sizeof(double) + 1); jj++) dbuf[jj] = (double)jj; @@ -8114,7 +8114,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, H5Dclose(ldid); H5Tclose(ltid); H5Sclose(lsid); - HDfree(dbuf); + free(dbuf); } /*------------------------------------------------------------------------- @@ -8229,7 +8229,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, n = 0; for (i = 0; i < 3; i++) for (j = 0; j < 2; j++) { - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = malloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) @@ -8408,7 +8408,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, hid_t fid, for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) for (k = 0; k < 2; k++) { - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) @@ -8500,10 +8500,10 @@ gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) int i; /* allocate the buffer for write the references */ - rbuf = (hdset_reg_ref_t *)HDcalloc((size_t)2, sizeof(hdset_reg_ref_t)); + rbuf = (hdset_reg_ref_t *)calloc((size_t)2, sizeof(hdset_reg_ref_t)); /* allocate the buffer for write the data dataset */ - buf = (int *)HDmalloc(10 * 10 * sizeof(int)); + buf = (int *)malloc(10 * 10 * sizeof(int)); for (i = 0; i < 10 * 10; i++) buf[i] = i; @@ -8579,8 +8579,8 @@ gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) status = H5Sclose(sid2); assert(status >= 0); - HDfree(rbuf); - HDfree(buf); + free(rbuf); + free(buf); } /*------------------------------------------------------------------------- @@ -8631,7 +8631,7 @@ test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers goto out; /* create a evenly divided buffer from 0 to 127 */ - buf = (char *)HDmalloc((size_t)(nelmts * size)); + buf = (char *)malloc((size_t)(nelmts * size)); s = 1024 * 1024 / 127; for (i = 0, j = 0, c = 0; i < 1024 * 1024; j++, i++) { if (j == s) { @@ -8656,7 +8656,7 @@ test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers goto out; } } - HDfree(buf); + free(buf); buf = NULL; /* close */ diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 82ac178..776e914 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -470,13 +470,13 @@ gent_dataset(void) int i, j; /* Set up data arrays */ - dset1_data = (int *)HDcalloc(10 * 20, sizeof(int)); - dset1 = (int **)HDcalloc(10, sizeof(dset1_data)); + dset1_data = (int *)calloc(10 * 20, sizeof(int)); + dset1 = (int **)calloc(10, sizeof(dset1_data)); for (i = 0; i < 10; i++) dset1[i] = dset1_data + (i * 20); - dset2_data = (double *)HDcalloc(30 * 20, sizeof(double)); - dset2 = (double **)HDcalloc(30, sizeof(dset2_data)); + dset2_data = (double *)calloc(30 * 20, sizeof(double)); + dset2 = (double **)calloc(30, sizeof(dset2_data)); for (i = 0; i < 30; i++) dset2[i] = dset2_data + (i * 20); @@ -512,10 +512,10 @@ gent_dataset(void) H5Dclose(dataset); H5Fclose(fid); - HDfree(dset1); - HDfree(dset1_data); - HDfree(dset2); - HDfree(dset2_data); + free(dset1); + free(dset1_data); + free(dset2); + free(dset2_data); } static void @@ -1808,8 +1808,8 @@ gent_str(void) hsize_t mdims[2]; /* Set up data array */ - comp1_data = (compound_t *)HDcalloc(3 * 6, sizeof(compound_t)); - comp1 = (compound_t **)HDcalloc(3, sizeof(comp1_data)); + comp1_data = (compound_t *)calloc(3 * 6, sizeof(compound_t)); + comp1 = (compound_t **)calloc(3, sizeof(comp1_data)); for (i = 0; i < 3; i++) comp1[i] = comp1_data + (i * 6); @@ -1909,8 +1909,8 @@ gent_str(void) H5Fclose(fid); - HDfree(comp1); - HDfree(comp1_data); + free(comp1); + free(comp1_data); } /* @@ -2126,9 +2126,9 @@ gent_objref(void) uint64_t supports_comments = 0; /* Allocate write & read buffers */ - wbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - rbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); - tbuf = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); + tbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * SPACE1_DIM1); /* Create file */ fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2211,9 +2211,9 @@ gent_objref(void) H5Fclose(fid1); /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(tbuf); + free(wbuf); + free(rbuf); + free(tbuf); } static void @@ -2240,10 +2240,10 @@ gent_datareg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + drbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); /* Create file */ fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2331,10 +2331,10 @@ gent_datareg(void) H5Fclose(fid1); /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); + free(wbuf); + free(rbuf); + free(dwbuf); + free(drbuf); } static void @@ -2364,10 +2364,10 @@ gent_attrreg(void) int i; /* counting variables */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); - dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); - drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + rbuf = (hdset_reg_ref_t *)malloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1); + dwbuf = (uint8_t *)malloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2); + drbuf = (uint8_t *)calloc(sizeof(uint8_t), SPACE2_DIM1 * SPACE2_DIM2); /* Create file */ fid1 = H5Fcreate(FILE64, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -2464,10 +2464,10 @@ gent_attrreg(void) H5Fclose(fid1); /* Free memory buffers */ - HDfree(wbuf); - HDfree(rbuf); - HDfree(dwbuf); - HDfree(drbuf); + free(wbuf); + free(rbuf); + free(dwbuf); + free(drbuf); } /*taken from Elena's compound test file*/ @@ -2695,7 +2695,7 @@ gent_vldatatypes(void) for (i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + wdata[i].p = malloc((size_t)(i + 1) * sizeof(int)); wdata[i].len = (size_t)(i + 1); for (j = 0; j < i + 1; j++) @@ -2722,7 +2722,7 @@ gent_vldatatypes(void) for (i = 0; i < SPACE1_DIM1; i++) { int j; - wdata[i].p = HDmalloc((size_t)(i + 1) * sizeof(float)); + wdata[i].p = malloc((size_t)(i + 1) * sizeof(float)); wdata[i].len = (size_t)(i + 1); for (j = 0; j < i + 1; j++) @@ -2746,7 +2746,7 @@ gent_vldatatypes(void) assert(ret >= 0); /* Allocate and initialize a scalar VL dataset to write */ - adata.p = HDmalloc(37 * sizeof(int)); + adata.p = malloc(37 * sizeof(int)); adata.len = 37; for (i = 0; i < 37; i++) @@ -2786,14 +2786,14 @@ gent_vldatatypes2(void) /* Allocate and initialize VL data to write */ for (i = 0; i < SPACE1_DIM1; i++) { - wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t)); + wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t)); if (wdata[i].p == NULL) { printf("Cannot allocate memory for VL data! i=%u\n", i); return; } /* end if */ wdata[i].len = i + 1; for (t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) { - t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned)); + t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned)); if (t1->p == NULL) { printf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); return; @@ -2861,7 +2861,7 @@ gent_vldatatypes3(void) for (i = 0; i < SPACE1_DIM1; i++) { wdata[i].i = (int)(i * 10); wdata[i].f = (float)((float)(i * 20) / 3.0F); - wdata[i].v.p = HDmalloc((size_t)(i + 1) * sizeof(unsigned int)); + wdata[i].v.p = malloc((size_t)(i + 1) * sizeof(unsigned int)); wdata[i].v.len = (size_t)(i + 1); for (j = 0; j < (i + 1); j++) ((unsigned int *)wdata[i].v.p)[j] = i * 10 + j; @@ -2929,7 +2929,7 @@ gent_vldatatypes4(void) /* Allocate and initialize VL data to write */ for (i = 0; i < SPACE1_DIM1; i++) { - wdata[i].p = HDmalloc((i + 1) * sizeof(s1)); + wdata[i].p = malloc((i + 1) * sizeof(s1)); wdata[i].len = i + 1; for (j = 0; j < (i + 1); j++) { ((s1 *)wdata[i].p)[j].i = (int)(i * 10 + j); @@ -3000,7 +3000,7 @@ gent_vldatatypes5(void) } /* end if */ else { wdata[i].len = (size_t)(i + 5); - wdata[i].p = HDmalloc(sizeof(unsigned) * (size_t)(i + 5)); + wdata[i].p = malloc(sizeof(unsigned) * (size_t)(i + 5)); for (j = 0; j < i + 5; j++) ((unsigned *)wdata[i].p)[j] = (unsigned)(j * 2); } /* end else */ @@ -3079,8 +3079,8 @@ gent_array1_big(void) block[0] = 1; /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); - wdata = (int *)HDmalloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); + wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + wdata = (int *)malloc(sizeof(int) * (size_t)(SPACE_ARRAY1BIG_DIM * ARRAY1BIG_DIM)); /* Allocate and initialize array data to write */ for (i = 0; i < SPACE_ARRAY1BIG_DIM; i++) @@ -3137,8 +3137,8 @@ gent_array1_big(void) assert(ret >= 0); /* Release memory */ - HDfree(wbuf); - HDfree(wdata); + free(wbuf); + free(wdata); } static void @@ -3447,7 +3447,7 @@ gent_array6(void) /* Initialize array data to write */ for (i = 0; i < SPACE1_DIM1; i++) for (j = 0; j < ARRAY1_DIM1; j++) { - wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * sizeof(unsigned int)); + wdata[i][j].p = malloc((size_t)(i + j + 1) * sizeof(unsigned int)); wdata[i][j].len = (size_t)(i + j + 1); for (k = 0; k < (i + j + 1); k++) ((unsigned int *)wdata[i][j].p)[k] = (unsigned)(i * 100 + j * 10 + k); @@ -3509,7 +3509,7 @@ gent_array7(void) /* Initialize array data to write */ for (i = 0; i < SPACE1_DIM1; i++) for (j = 0; j < ARRAY1_DIM1; j++) { - wdata[i][j].p = HDmalloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1)); + wdata[i][j].p = malloc((size_t)(i + j + 1) * (sizeof(unsigned int) * ARRAY1_DIM1)); wdata[i][j].len = (size_t)(i + j + 1); for (k = 0; k < (i + j + 1); k++) for (l = 0; l < ARRAY1_DIM1; l++) @@ -3577,7 +3577,7 @@ gent_array8(void) unsigned int i; /* Allocate data buffer */ - wdata = (int *)HDmalloc(F64_DIM1 * sizeof(int)); + wdata = (int *)malloc(F64_DIM1 * sizeof(int)); assert(wdata); /* @@ -3624,7 +3624,7 @@ gent_array8(void) assert(status >= 0); status = H5Fclose(file); assert(status >= 0); - HDfree(wdata); + free(wdata); } static void @@ -3869,8 +3869,8 @@ gent_multi(void) char *sv_data = NULL; haddr_t memb_addr[H5FD_MEM_NTYPES]; - sv_data = (char *)HDcalloc(H5FD_MEM_NTYPES * 1024, sizeof(char)); - sv = (char **)HDcalloc(H5FD_MEM_NTYPES, sizeof(sv_data)); + sv_data = (char *)calloc(H5FD_MEM_NTYPES * 1024, sizeof(char)); + sv = (char **)calloc(H5FD_MEM_NTYPES, sizeof(sv_data)); for (i = 0; i < H5FD_MEM_NTYPES; i++) sv[i] = sv_data + (i * 1024); @@ -3914,8 +3914,8 @@ gent_multi(void) H5Fclose(fid); H5Pclose(fapl); - HDfree(sv); - HDfree(sv_data); + free(sv); + free(sv_data); } static void @@ -4157,10 +4157,10 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -4266,7 +4266,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (j = 0; j < 2; j++) { int l; - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = malloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4396,7 +4396,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((size_t)(i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; @@ -4586,10 +4586,10 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -4695,7 +4695,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (j = 0; j < 2; j++) { int l; - buf52[i][j].p = HDmalloc((size_t)(i + 1) * sizeof(int)); + buf52[i][j].p = malloc((size_t)(i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) ((int *)buf52[i][j].p)[l] = n++; @@ -4832,7 +4832,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (k = 0; k < 2; k++) { int l; - buf53[i][j][k].p = HDmalloc(((size_t)i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc(((size_t)i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) ((int *)buf53[i][j][k].p)[l] = n++; @@ -6022,10 +6022,10 @@ gent_fvalues(void) *------------------------------------------------------------------------- */ buf3[0].len = 1; - buf3[0].p = HDmalloc(1 * sizeof(int)); + buf3[0].p = malloc(1 * sizeof(int)); ((int *)buf3[0].p)[0] = 1; buf3[1].len = 2; - buf3[1].p = HDmalloc(2 * sizeof(int)); + buf3[1].p = malloc(2 * sizeof(int)); ((int *)buf3[1].p)[0] = 2; ((int *)buf3[1].p)[1] = 3; @@ -6276,7 +6276,7 @@ gent_longlinks(void) assert(gid >= 0); /* Construct very long file name */ - objname = (char *)HDmalloc((size_t)(F51_MAX_NAME_LEN + 1)); + objname = (char *)malloc((size_t)(F51_MAX_NAME_LEN + 1)); assert(objname); for (u = 0; u < F51_MAX_NAME_LEN; u++) objname[u] = 'a'; @@ -6299,7 +6299,7 @@ gent_longlinks(void) assert(H5Fclose(fid) >= 0); /* Release memory */ - HDfree(objname); + free(objname); } /*------------------------------------------------------------------------- @@ -6520,7 +6520,7 @@ gent_bigdims(void) if ((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - buf = (char *)HDmalloc((unsigned)(nelmts * size)); + buf = (char *)malloc((unsigned)(nelmts * size)); for (i = 0, c = 0; i < nelmts; i++, c++) { buf[i] = c; @@ -6531,7 +6531,7 @@ gent_bigdims(void) if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0) goto out; - HDfree(buf); + free(buf); buf = NULL; /* close */ @@ -6586,7 +6586,7 @@ gent_hyperslab(void) int i; int H5_ATTR_NDEBUG_UNUSED ret; - buf = (double *)HDmalloc(32 * 4097 * sizeof(double)); + buf = (double *)malloc(32 * 4097 * sizeof(double)); for (i = 0; i < 32 * 4097; i++) buf[i] = 1; @@ -6599,7 +6599,7 @@ gent_hyperslab(void) ret = H5Fclose(fid); assert(ret >= 0); - HDfree(buf); + free(buf); } /*------------------------------------------------------------------------- @@ -7479,15 +7479,15 @@ gent_packedbits(void) H5Dclose(dataset); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); } /*------------------------------------------------------------------------- @@ -7733,15 +7733,15 @@ gent_attr_intsize(void) H5Gclose(root); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); } static void @@ -7925,7 +7925,7 @@ gent_compound_intsizes(void) int m, n, o; /* Array init loop vars */ /* Allocate buffer */ - Array1 = (Array1Struct *)HDmalloc(sizeof(Array1Struct) * F70_LENGTH); + Array1 = (Array1Struct *)malloc(sizeof(Array1Struct) * F70_LENGTH); assert(Array1); /* Initialize the data in the arrays/datastructure */ @@ -8159,7 +8159,7 @@ gent_compound_intsizes(void) status = H5Fclose(fid); assert(status >= 0); - HDfree(Array1); + free(Array1); } static void @@ -8208,7 +8208,7 @@ gent_compound_attr_intsizes(void) int m, n, o; /* Array init loop vars */ - Array1 = (Array1Struct *)HDcalloc(F70_LENGTH, sizeof(Array1Struct)); + Array1 = (Array1Struct *)calloc(F70_LENGTH, sizeof(Array1Struct)); /* Initialize the data in the arrays/datastructure */ for (m = 0; m < F70_LENGTH; m++) { @@ -8451,7 +8451,7 @@ gent_compound_attr_intsizes(void) status = H5Fclose(fid); assert(status >= 0); - HDfree(Array1); + free(Array1); } static void @@ -8854,15 +8854,15 @@ gent_intscalars(void) H5Dclose(dataset); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); } /*------------------------------------------------------------------------- @@ -9118,15 +9118,15 @@ gent_attr_intscalars(void) H5Gclose(root); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); } /*------------------------------------------------------------------------- @@ -9229,7 +9229,7 @@ gent_compound_int_array(void) int m, n; /* Array init loop vars */ /* Allocate buffer */ - Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F76_LENGTH); + Cmpd1 = (Cmpd1Struct *)malloc(sizeof(Cmpd1Struct) * F76_LENGTH); assert(Cmpd1); /* Initialize the data in the arrays/datastructure */ @@ -9437,7 +9437,7 @@ gent_compound_int_array(void) status = H5Fclose(fid); assert(status >= 0); - HDfree(Cmpd1); + free(Cmpd1); } static void @@ -9487,9 +9487,9 @@ gent_compound_ints(void) int m; /* Array init loop vars */ /* Allocate buffers */ - Cmpd1 = (Cmpd1Struct *)HDmalloc(sizeof(Cmpd1Struct) * F77_LENGTH); + Cmpd1 = (Cmpd1Struct *)malloc(sizeof(Cmpd1Struct) * F77_LENGTH); assert(Cmpd1); - Cmpd2 = (Cmpd2Struct *)HDmalloc(sizeof(Cmpd2Struct) * F77_LENGTH); + Cmpd2 = (Cmpd2Struct *)malloc(sizeof(Cmpd2Struct) * F77_LENGTH); assert(Cmpd2); /* Initialize the data in the arrays/datastructure */ @@ -9669,8 +9669,8 @@ gent_compound_ints(void) status = H5Fclose(fid); assert(status >= 0); - HDfree(Cmpd1); - HDfree(Cmpd2); + free(Cmpd1); + free(Cmpd2); } /*------------------------------------------------------------------------- @@ -9958,15 +9958,15 @@ gent_intattrscalars(void) H5Dclose(dataset); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); } /*------------------------------------------------------------------------- @@ -10049,15 +10049,15 @@ gent_intsattrs(void) dset64 = malloc(sizeof(*dset64)); dsetdbl = malloc(sizeof(*dsetdbl)); - asetu8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t)); - asetu16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t)); - asetu32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(uint32_t)); - asetu64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(uint64_t)); - aset8 = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(int8_t)); - aset16 = HDcalloc(F66_XDIM * F66_YDIM16, sizeof(int16_t)); - aset32 = HDcalloc(F66_XDIM * F66_YDIM32, sizeof(int32_t)); - aset64 = HDcalloc(F66_XDIM * F66_YDIM64, sizeof(int64_t)); - asetdbl = HDcalloc(F66_XDIM * F66_YDIM8, sizeof(double)); + asetu8 = calloc(F66_XDIM * F66_YDIM8, sizeof(uint8_t)); + asetu16 = calloc(F66_XDIM * F66_YDIM16, sizeof(uint16_t)); + asetu32 = calloc(F66_XDIM * F66_YDIM32, sizeof(uint32_t)); + asetu64 = calloc(F66_XDIM * F66_YDIM64, sizeof(uint64_t)); + aset8 = calloc(F66_XDIM * F66_YDIM8, sizeof(int8_t)); + aset16 = calloc(F66_XDIM * F66_YDIM16, sizeof(int16_t)); + aset32 = calloc(F66_XDIM * F66_YDIM32, sizeof(int32_t)); + aset64 = calloc(F66_XDIM * F66_YDIM64, sizeof(int64_t)); + asetdbl = calloc(F66_XDIM * F66_YDIM8, sizeof(double)); fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -10309,25 +10309,25 @@ gent_intsattrs(void) H5Dclose(dataset); H5Fclose(fid); - HDfree(dsetu8); - HDfree(dsetu16); - HDfree(dsetu32); - HDfree(dsetu64); - HDfree(dset8); - HDfree(dset16); - HDfree(dset32); - HDfree(dset64); - HDfree(dsetdbl); - - HDfree(asetu8); - HDfree(asetu16); - HDfree(asetu32); - HDfree(asetu64); - HDfree(aset8); - HDfree(aset16); - HDfree(aset32); - HDfree(aset64); - HDfree(asetdbl); + free(dsetu8); + free(dsetu16); + free(dsetu32); + free(dsetu64); + free(dset8); + free(dset16); + free(dset32); + free(dset64); + free(dsetdbl); + + free(asetu8); + free(asetu16); + free(asetu32); + free(asetu64); + free(aset8); + free(aset16); + free(aset32); + free(aset64); + free(asetdbl); } /*------------------------------------------------------------------------- @@ -10374,9 +10374,9 @@ gent_floatsattrs(void) dset64 = malloc(sizeof(*dset64)); dset128 = malloc(sizeof(*dset128)); - aset32 = HDcalloc(F89_XDIM * F89_YDIM32, sizeof(float)); - aset64 = HDcalloc(F89_XDIM * F89_YDIM64, sizeof(double)); - aset128 = HDcalloc(F89_XDIM * F89_YDIM128, sizeof(long double)); + aset32 = calloc(F89_XDIM * F89_YDIM32, sizeof(float)); + aset64 = calloc(F89_XDIM * F89_YDIM64, sizeof(double)); + aset128 = calloc(F89_XDIM * F89_YDIM128, sizeof(long double)); fid = H5Fcreate(FILE89, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -10473,13 +10473,13 @@ gent_floatsattrs(void) error: H5Fclose(fid); - HDfree(dset32); - HDfree(dset64); - HDfree(dset128); + free(dset32); + free(dset64); + free(dset128); - HDfree(aset32); - HDfree(aset64); - HDfree(aset128); + free(aset32); + free(aset64); + free(aset128); } static void @@ -10754,7 +10754,7 @@ gent_compound_complex2(void) hsize_t nelmts = F82_DIM32; /* Allocate buffer */ - buf = (compound *)HDmalloc(sizeof(compound) * F82_DIM32); + buf = (compound *)malloc(sizeof(compound) * F82_DIM32); assert(buf); file = H5Fcreate(FILE82, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -11010,7 +11010,7 @@ gent_compound_complex2(void) */ H5Fclose(file); - HDfree(buf); + free(buf); } /*------------------------------------------------------------------------- @@ -11367,17 +11367,17 @@ onion_filepaths_init(const char *basename) { struct onion_filepaths *paths = NULL; - if (NULL == (paths = HDcalloc(1, sizeof(struct onion_filepaths)))) + if (NULL == (paths = calloc(1, sizeof(struct onion_filepaths)))) goto error; if (NULL == (paths->canon = HDstrdup(basename))) goto error; - if (NULL == (paths->onion = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) + if (NULL == (paths->onion = malloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) goto error; HDsnprintf(paths->onion, ONION_TEST_FIXNAME_SIZE, "%s.onion", paths->canon); - if (NULL == (paths->recovery = HDmalloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) + if (NULL == (paths->recovery = malloc(sizeof(char) * ONION_TEST_FIXNAME_SIZE))) goto error; HDsnprintf(paths->recovery, ONION_TEST_FIXNAME_SIZE, "%s.onion.recovery", paths->canon); @@ -11385,10 +11385,10 @@ onion_filepaths_init(const char *basename) error: if (paths != NULL) { - HDfree(paths->canon); - HDfree(paths->onion); - HDfree(paths->recovery); - HDfree(paths); + free(paths->canon); + free(paths->onion); + free(paths->recovery); + free(paths); } return NULL; } @@ -11397,10 +11397,10 @@ static void onion_filepaths_destroy(struct onion_filepaths *s) { if (s) { - HDfree(s->canon); - HDfree(s->onion); - HDfree(s->recovery); - HDfree(s); + free(s->canon); + free(s->onion); + free(s->recovery); + free(s); } } diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index 3718964..9a3a891 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -423,7 +423,7 @@ gen_err_level(const char *fname) goto error; /* Initialize data buffer */ - buf = (unsigned char *)HDmalloc(NUM * sizeof(unsigned char *)); + buf = (unsigned char *)malloc(NUM * sizeof(unsigned char *)); HDmemset(buf, 42, NUM * sizeof(unsigned char)); /* Create the test file */ diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index 192371d..5ac9c7f 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -120,7 +120,7 @@ main(int argc, char *argv[]) goto error; } /* end if */ - if (NULL == (buf = (char *)HDmalloc((unsigned)(size + 1)))) { + if (NULL == (buf = (char *)malloc((unsigned)(size + 1)))) { error_msg("can't allocate buffer \n"); goto error; } /* end if */ @@ -137,15 +137,15 @@ main(int argc, char *argv[]) } /* end if */ /* close things and exit */ - HDfree(filename); - HDfree(buf); + free(filename); + free(buf); HDclose(fd); return EXIT_SUCCESS; error: - HDfree(filename); - HDfree(buf); + free(filename); + free(buf); if (fd >= 0) HDclose(fd); return EXIT_FAILURE; diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index a9df43b..96e6407 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -369,7 +369,7 @@ create_textfile(const char *name, size_t size) if ((fd = HDcreat(name, 0777)) < 0) goto error; - if (NULL == (buf = (char *)HDcalloc(size, 1))) + if (NULL == (buf = (char *)calloc(size, 1))) goto error; /* Fill buf with pattern */ @@ -380,13 +380,13 @@ create_textfile(const char *name, size_t size) if (HDwrite(fd, buf, size) < 0) goto error; - HDfree(buf); + free(buf); HDclose(fd); return SUCCEED; error: - HDfree(buf); + free(buf); if (fd >= 0) HDclose(fd); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index ca56c79..9364ea8 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -2505,7 +2505,7 @@ make_szip(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2517,7 +2517,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -2590,7 +2590,7 @@ make_deflate(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2602,7 +2602,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -2660,7 +2660,7 @@ make_shuffle(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2672,7 +2672,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -2733,7 +2733,7 @@ make_fletcher32(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2745,7 +2745,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -2838,7 +2838,7 @@ make_nbit(hid_t loc_id) if (H5Tclose(dtid) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2853,7 +2853,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -2940,7 +2940,7 @@ make_scaleoffset(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -2955,7 +2955,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -3124,7 +3124,7 @@ make_all_filters(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -3139,7 +3139,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -3321,7 +3321,7 @@ make_layout(hid_t loc_id) if (H5Pclose(dcpl) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -3333,7 +3333,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return -1; } @@ -3406,7 +3406,7 @@ error: } H5E_END_TRY - HDfree(s_buf); + free(s_buf); return (ret_value); @@ -3533,8 +3533,8 @@ make_layout3(hid_t loc_id) if (H5Pclose(dcpl3) < 0) goto error; - HDfree(buf1); - HDfree(buf2); + free(buf1); + free(buf2); return 0; @@ -3549,8 +3549,8 @@ error: } H5E_END_TRY - HDfree(buf1); - HDfree(buf2); + free(buf1); + free(buf2); return -1; } @@ -3656,14 +3656,14 @@ make_big(hid_t loc_id) goto out; /* initialize buffer to 0 */ - buf = (signed char *)HDcalloc(nelmts, size); + buf = (signed char *)calloc(nelmts, size); if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto out; if (H5Dwrite(did, H5T_NATIVE_SCHAR, m_sid, f_sid, H5P_DEFAULT, buf) < 0) goto out; - HDfree(buf); + free(buf); buf = NULL; /* close */ @@ -4118,10 +4118,10 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -4177,7 +4177,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* allocate and initialize array data to write */ size = (TEST_BUFSIZE / sizeof(double) + 1) * sizeof(double); - dbuf = (double *)HDmalloc(size); + dbuf = (double *)malloc(size); if (NULL == dbuf) { printf("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int)size / 1000000); @@ -4194,16 +4194,16 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* create a type larger than TEST_BUFSIZE */ if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) { - HDfree(dbuf); + free(dbuf); goto out; } size = H5Tget_size(tid); if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) { - HDfree(dbuf); + free(dbuf); goto out; } if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - HDfree(dbuf); + free(dbuf); goto out; } #if defined(WRITE_ARRAY) @@ -4214,7 +4214,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da H5Dclose(did); H5Tclose(tid); H5Sclose(sid); - HDfree(dbuf); + free(dbuf); } /*------------------------------------------------------------------------- @@ -4347,7 +4347,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (j = 0; j < 2; j++) { unsigned l; - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); + buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) @@ -4558,7 +4558,7 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (k = 0; k < 2; k++) { unsigned l; - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) { if (make_diffs) @@ -4682,8 +4682,8 @@ make_dset_reg_ref(hid_t loc_id) int retval = -1; /* return value */ /* Allocate write & read buffers */ - wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); - dwbuf = (int *)HDmalloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); + wbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1); + dwbuf = (int *)malloc(sizeof(int) * SPACE2_DIM1 * SPACE2_DIM2); /* Create dataspace for datasets */ if ((sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL)) < 0) @@ -4744,9 +4744,9 @@ make_dset_reg_ref(hid_t loc_id) out: if (wbuf) - HDfree(wbuf); + free(wbuf); if (dwbuf) - HDfree(dwbuf); + free(dwbuf); H5E_BEGIN_TRY { @@ -5016,10 +5016,10 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = HDmalloc(1 * sizeof(int)); + buf5[0].p = malloc(1 * sizeof(int)); ((int *)buf5[0].p)[0] = 1; buf5[1].len = 2; - buf5[1].p = HDmalloc(2 * sizeof(int)); + buf5[1].p = malloc(2 * sizeof(int)); ((int *)buf5[1].p)[0] = 2; ((int *)buf5[1].p)[1] = 3; @@ -5324,7 +5324,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (j = 0; j < 2; j++) { unsigned l; - buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); + buf52[i][j].p = malloc((i + 1) * sizeof(int)); buf52[i][j].len = (size_t)(i + 1); for (l = 0; l < i + 1; l++) if (make_diffs) @@ -5771,7 +5771,7 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da for (k = 0; k < 2; k++) { unsigned l; - buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); buf53[i][j][k].len = (size_t)i + 1; for (l = 0; l < i + 1; l++) if (make_diffs) @@ -6966,11 +6966,11 @@ make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_objref_data[0].len = LEN0_VLEN_OBJREF; - vlen_objref_data[0].p = HDmalloc(vlen_objref_data[0].len * sizeof(hobj_ref_t)); + vlen_objref_data[0].p = malloc(vlen_objref_data[0].len * sizeof(hobj_ref_t)); vlen_objref_data[1].len = LEN1_VLEN_OBJREF; - vlen_objref_data[1].p = HDmalloc(vlen_objref_data[1].len * sizeof(hobj_ref_t)); + vlen_objref_data[1].p = malloc(vlen_objref_data[1].len * sizeof(hobj_ref_t)); vlen_objref_data[2].len = LEN2_VLEN_OBJREF; - vlen_objref_data[2].p = HDmalloc(vlen_objref_data[2].len * sizeof(hobj_ref_t)); + vlen_objref_data[2].p = malloc(vlen_objref_data[2].len * sizeof(hobj_ref_t)); /* * create obj references @@ -7034,7 +7034,7 @@ make_complex_attr_references(hid_t loc_id) * prepare vlen data */ vlen_regref_data[0].len = LEN0_VLEN_REGREF; - vlen_regref_data[0].p = HDmalloc(vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); + vlen_regref_data[0].p = malloc(vlen_regref_data[0].len * sizeof(hdset_reg_ref_t)); /* * create region reference diff --git a/tools/test/misc/clear_open_chk.c b/tools/test/misc/clear_open_chk.c index ac31375..b57eb4a 100644 --- a/tools/test/misc/clear_open_chk.c +++ b/tools/test/misc/clear_open_chk.c @@ -54,10 +54,10 @@ main(int argc, char *argv[]) /* Try opening the file */ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, FALSE, NULL, (size_t)0)) < 0) { fprintf(stderr, "clear_open_chk: unable to open the file\n"); - HDfree(fname); + free(fname); HDexit(EXIT_FAILURE); } - HDfree(fname); + free(fname); /* Close the file */ if (H5Fclose(fid) < 0) { diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 31796c1..3636c98 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -124,7 +124,7 @@ gen_cache_image_file(const char *fname) if (H5Fclose(fid) < 0) goto error; - HDfree(buf); + free(buf); return 0; @@ -140,7 +140,7 @@ error: } H5E_END_TRY - HDfree(buf); + free(buf); return 1; } /* gen_cache_image_file() */ diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c index 04ac8e7..1f26c4d 100644 --- a/tools/test/misc/h5repart_gentest.c +++ b/tools/test/misc/h5repart_gentest.c @@ -36,12 +36,12 @@ main(void) hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE}; /* Set up data array */ - if (NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) { - HDperror("HDcalloc"); + if (NULL == (buf_data = (int *)calloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int)))) { + HDperror("calloc"); HDexit(EXIT_FAILURE); } - if (NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data)))) { - HDperror("HDcalloc"); + if (NULL == (buf = (int **)calloc(FAMILY_NUMBER, sizeof(buf_data)))) { + HDperror("calloc"); HDexit(EXIT_FAILURE); } for (i = 0; i < FAMILY_NUMBER; i++) @@ -103,8 +103,8 @@ main(void) HDexit(EXIT_FAILURE); } - HDfree(buf); - HDfree(buf_data); + free(buf); + free(buf_data); HDputs(" PASSED"); HDfflush(stdout); diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 72b98ed..c876d9f 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -122,7 +122,7 @@ main(void) H5Dclose(set); /* Now open the set, and read it back in */ - data = (char *)HDmalloc(H5Tget_size(fix)); + data = (char *)malloc(H5Tget_size(fix)); if (!data) { HDperror("malloc() failed"); @@ -186,7 +186,7 @@ out: } if (data) - HDfree(data); + free(data); H5Sclose(spc); H5Tclose(cs6); H5Tclose(cmp); diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 33ea706..3d258ea 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -134,7 +134,7 @@ create_dset1(hid_t file) H5Dclose(dataset); H5Pclose(dcpl); H5Sclose(dataspace); - HDfree(data); + free(data); return 0; error: @@ -145,7 +145,7 @@ error: H5Sclose(dataspace); } H5E_END_TRY - HDfree(data); + free(data); return 1; } @@ -198,7 +198,7 @@ create_dset2(hid_t file) H5Dclose(dataset); H5Pclose(dcpl); H5Sclose(dataspace); - HDfree(data); + free(data); return 0; @@ -210,7 +210,7 @@ error: H5Sclose(dataspace); } H5E_END_TRY - HDfree(data); + free(data); return 1; } diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index d47420a..8d0daf0 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -159,7 +159,7 @@ main(void) assert(file_space >= 0); dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); assert(dset >= 0); - the_data = (unsigned char *)HDmalloc((size_t)(size[0] * size[1])); + the_data = (unsigned char *)malloc((size_t)(size[0] * size[1])); /* initial fill for lazy malloc */ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1])); @@ -347,7 +347,7 @@ main(void) H5Sclose(file_space); H5Fclose(file); - HDfree(the_data); + free(the_data); return 0; } diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c index abd1649..c891bf9 100644 --- a/tools/test/perform/zip_perf.c +++ b/tools/test/perform/zip_perf.c @@ -104,7 +104,7 @@ cleanup(void) { if (!HDgetenv(HDF5_NOCLEANUP)) HDunlink(filename); - HDfree(filename); + free(filename); } static void @@ -117,7 +117,7 @@ write_file(Bytef *source, uLongf sourceLen) /* destination buffer needs to be at least 0.1% larger than sourceLen * plus 12 bytes */ destLen = (uLongf)((double)sourceLen + ((double)sourceLen * 0.1)) + 12; - dest = (Bytef *)HDmalloc(destLen); + dest = (Bytef *)malloc(destLen); if (!dest) error("out of memory"); @@ -151,7 +151,7 @@ write_file(Bytef *source, uLongf sourceLen) d_ptr += rc; } - HDfree(dest); + free(dest); } /* @@ -211,9 +211,9 @@ get_unique_name(void) if (prefix) /* 2 = 1 for '/' + 1 for null terminator */ - filename = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2); + filename = (char *)malloc(HDstrlen(prefix) + HDstrlen(ZIP_PERF_FILE) + 2); else - filename = (char *)HDmalloc(HDstrlen(ZIP_PERF_FILE) + 1); + filename = (char *)malloc(HDstrlen(ZIP_PERF_FILE) + 1); if (!filename) error("out of memory"); @@ -364,7 +364,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long unsigned long i, iters; iters = file_size / src_len; - src = (Bytef *)HDcalloc(1, sizeof(Bytef) * src_len); + src = (Bytef *)calloc(1, sizeof(Bytef) * src_len); if (!src) { cleanup(); @@ -452,7 +452,7 @@ do_write_test(unsigned long file_size, unsigned long min_buf_size, unsigned long fprintf(stdout, "\tCompression Time: %gs\n", compression_time); HDunlink(filename); - HDfree(src); + free(src); } } |