diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 20:43:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 20:43:30 (GMT) |
commit | 1e91d96fa02466ffe451319bdac1005f84dc7993 (patch) | |
tree | 4de04ef502c313dfd766497b20235188761146c0 /tools/lib | |
parent | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff) | |
download | hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2 |
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 75 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 126 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 38 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 78 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 64 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 170 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 12 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 100 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 104 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 110 | ||||
-rw-r--r-- | tools/lib/io_timer.c | 12 |
13 files changed, 446 insertions, 447 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index ea268f3..7232ed0 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -112,11 +112,11 @@ print_incoming_data(void) do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); if (incomingMessage) { - HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1); + memset(data, 0, PRINT_DATA_MAX_SIZE + 1); MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - HDprintf("%s", data); + printf("%s", data); } } while (incomingMessage); } @@ -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; } } @@ -494,7 +494,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata) H5TOOLS_START_DEBUG(" "); /* init linkinfo struct */ - HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t)); + memset(&lnk_info, 0, sizeof(h5tool_link_info_t)); if (!opts->follow_links) { trav_info_visit_lnk(path, linfo, tinfo); @@ -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; } @@ -628,10 +628,10 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char H5TOOLS_START_DEBUG(" "); /* init filenames */ - HDmemset(filenames, 0, MAX_FILENAME * 2); + memset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ - HDmemset(&trg_linfo1, 0, sizeof(h5tool_link_info_t)); - HDmemset(&trg_linfo2, 0, sizeof(h5tool_link_info_t)); + memset(&trg_linfo1, 0, sizeof(h5tool_link_info_t)); + memset(&trg_linfo2, 0, sizeof(h5tool_link_info_t)); /*------------------------------------------------------------------------- * check invalid combination of options @@ -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); @@ -776,7 +776,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); idx = info1_obj->nused - 1; - HDmemcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t)); + memcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t)); info1_obj->paths[idx].fileno = oinfo1.fileno; } else if (src_linfo1.type == H5L_TYPE_SOFT) { @@ -826,7 +826,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); idx = info2_obj->nused - 1; - HDmemcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t)); + memcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t)); info2_obj->paths[idx].fileno = oinfo2.fileno; } else if (src_linfo2.type == H5L_TYPE_SOFT) { @@ -896,7 +896,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char size_t idx = info1_lp->nused - 1; H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null"); - HDmemcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t)); + memcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t)); info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type; info1_lp->paths[idx].fileno = trg_linfo1.fileno; } @@ -936,7 +936,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char size_t idx = info2_lp->nused - 1; H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null"); - HDmemcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t)); + memcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t)); info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type; info2_lp->paths[idx].fileno = trg_linfo2.fileno; } @@ -997,8 +997,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char int i; if ((HDstrlen(fname1) > MAX_FILENAME) || (HDstrlen(fname2) > MAX_FILENAME)) { - HDfprintf(stderr, "The parallel diff only supports path names up to %d characters\n", - MAX_FILENAME); + fprintf(stderr, "The parallel diff only supports path names up to %d characters\n", MAX_FILENAME); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -1068,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 @@ -1165,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; @@ -1174,7 +1173,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, MPI_Status Status; /*set all tasks as free */ - HDmemset(workerTasks, 1, (size_t)(g_nTasks - 1) * sizeof(char)); + memset(workerTasks, 1, (size_t)(g_nTasks - 1) * sizeof(char)); #endif for (i = 0; i < table->nobjs; i++) { @@ -1187,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"); } @@ -1205,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"); } @@ -1248,7 +1247,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, /*Set up args to pass to worker task. */ if (HDstrlen(obj1_fullpath) > 255 || HDstrlen(obj2_fullpath) > 255) { - HDprintf("The parallel diff only supports object names up to 255 characters\n"); + printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -1393,7 +1392,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, MPI_COMM_WORLD); } /* end else-if */ else { - HDprintf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); + printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); MPI_Finalize(); } /* end else */ @@ -1402,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); @@ -1473,15 +1472,15 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, hid_t file2_id, } /* end else-if */ else if (Status.MPI_TAG == MPI_TAG_PRINT_DATA) { char data[PRINT_DATA_MAX_SIZE + 1]; - HDmemset(data, 0, PRINT_DATA_MAX_SIZE + 1); + memset(data, 0, PRINT_DATA_MAX_SIZE + 1); MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - HDprintf("%s", data); + printf("%s", data); } /* end else-if */ else { - HDprintf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); + printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); } /* end else */ } /* end while */ @@ -1494,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 */ @@ -1549,8 +1548,8 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat); /*init link info struct */ - HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); - HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); + memset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); + memset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); /* pass how to handle printing warnings to linkinfo option */ if (print_warn(opts)) @@ -1834,7 +1833,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_ if (linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) { /* If the buffers are the same size, compare them */ if (linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) { - status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); + status = memcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); } else status = 1; @@ -1913,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 3f504eb..85defbe 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -212,7 +212,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ * by the condition, but it gives more clarity for code planning */ if (type_class != H5T_REFERENCE && type_class != H5T_COMPOUND && type_class != H5T_STRING && - type_class != H5T_VLEN && HDmemcmp(mem1, mem2, size * opts->hs_nelmts) == 0) { + type_class != H5T_VLEN && memcmp(mem1, mem2, size * opts->hs_nelmts) == 0) { H5TOOLS_ENDDEBUG(":Fast comparison - errstat:%d", opts->err_stat); return 0; } @@ -224,7 +224,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ case H5T_NCLASSES: default: H5TOOLS_DEBUG("type_class:INVALID"); - HDassert(0); + assert(0); break; /*------------------------------------------------------------------------- @@ -381,7 +381,7 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_ case H5T_VLEN: case H5T_REFERENCE: H5TOOLS_DEBUG("type_class:OTHER"); - HDmemset(&members, 0, sizeof(mcomp_t)); + memset(&members, 0, sizeof(mcomp_t)); get_member_types(opts->m_tid, &members); for (i = 0; i < opts->hs_nelmts; i++) { H5TOOLS_DEBUG("opts->pos[%" PRIuHSIZE "]:%" PRIuHSIZE " - nelmts:%" PRIuHSIZE, i, @@ -460,7 +460,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co * by the condition, but it gives more clarity for code planning */ if (type_class != H5T_REFERENCE && type_class != H5T_COMPOUND && type_class != H5T_STRING && - type_class != H5T_VLEN && HDmemcmp(mem1, mem2, type_size) == 0) + type_class != H5T_VLEN && memcmp(mem1, mem2, type_size) == 0) H5TOOLS_GOTO_DONE(opts->err_stat); switch (H5Tget_class(opts->m_tid)) { @@ -590,7 +590,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co /* check for NULL pointer for string */ if (s != NULL) { /* try fast compare first */ - if ((HDmemcmp(s, sx, size) == 0) && (size1 != size2)) { + if ((memcmp(s, sx, size) == 0) && (size1 != size2)) { for (u = size; u < sizex; u++) character_compare(s + u, sx + u, elemtno, u, opts); } @@ -707,7 +707,7 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co size = H5Tget_size(arr_opts.m_tid); ndims = H5Tget_array_ndims(opts->m_tid); H5Tget_array_dims2(opts->m_tid, adims); - HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); + assert(ndims >= 1 && ndims <= H5S_MAX_RANK); H5TOOLS_DEBUG("attr ph=%d", arr_opts.print_header); /* calculate the number of array elements */ @@ -1386,11 +1386,11 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di */ if (nblocks1 > 0) { H5TOOLS_DEBUG("region compare blocks"); - HDassert(ndims1 > 0); + assert(ndims1 > 0); alloc_size = (hsize_t)nblocks1 * (unsigned)ndims1 * 2 * sizeof(ptdata1[0]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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 */ } @@ -1460,9 +1460,9 @@ diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, di if (npoints1 > 0) { H5TOOLS_DEBUG("region compare points"); alloc_size = (hsize_t)npoints1 * (unsigned)ndims1 * sizeof(ptdata1[0]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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 */ } @@ -1556,8 +1556,8 @@ character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t char temp1_uchar; char temp2_uchar; - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar); if (temp1_uchar != temp2_uchar) { @@ -1598,8 +1598,8 @@ character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, /* both_zero is set in the PER_UNSIGN macro but not used in this function */ (void)both_zero; - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar); /* -d and !-p */ @@ -1673,8 +1673,8 @@ diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_float, mem1, sizeof(float)); - HDmemcpy(&temp2_float, mem2, sizeof(float)); + memcpy(&temp1_float, mem1, sizeof(float)); + memcpy(&temp2_float, mem2, sizeof(float)); /* logic for detecting NaNs is different with opts -d, -p and no opts */ @@ -1853,8 +1853,8 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_double, mem1, sizeof(double)); - HDmemcpy(&temp2_double, mem2, sizeof(double)); + memcpy(&temp1_double, mem1, sizeof(double)); + memcpy(&temp2_double, mem2, sizeof(double)); /*------------------------------------------------------------------------- * -d and !-p @@ -2026,8 +2026,8 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_double, mem1, sizeof(long double)); - HDmemcpy(&temp2_double, mem2, sizeof(long double)); + memcpy(&temp1_double, mem1, sizeof(long double)); + memcpy(&temp2_double, mem2, sizeof(long double)); /* logic for detecting NaNs is different with options -d, -p and no options */ @@ -2196,8 +2196,8 @@ diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d hbool_t both_zero = FALSE; H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); + memcpy(&temp1_char, mem1, sizeof(char)); + memcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { @@ -2285,8 +2285,8 @@ diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) { @@ -2373,8 +2373,8 @@ diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); + memcpy(&temp1_short, mem1, sizeof(short)); + memcpy(&temp2_short, mem2, sizeof(short)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_short - temp2_short) > opts->delta) { @@ -2461,8 +2461,8 @@ diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) { @@ -2553,8 +2553,8 @@ diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, dif H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); + memcpy(&temp1_int, mem1, sizeof(int)); + memcpy(&temp2_int, mem2, sizeof(int)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_int - temp2_int) > opts->delta) { @@ -2641,8 +2641,8 @@ diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + memcpy(&temp1_uint, mem1, sizeof(unsigned int)); + memcpy(&temp2_uint, mem2, sizeof(unsigned int)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_uint, temp2_uint) > opts->delta) { @@ -2729,8 +2729,8 @@ diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, di H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); + memcpy(&temp1_long, mem1, sizeof(long)); + memcpy(&temp2_long, mem2, sizeof(long)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (ABS(temp1_long - temp2_long) > (long)opts->delta) { @@ -2817,8 +2817,8 @@ diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { if (PDIFF(temp1_ulong, temp2_ulong) > (unsigned long)opts->delta) { @@ -2907,8 +2907,8 @@ diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, d H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + memcpy(&temp1_llong, mem1, sizeof(long long)); + memcpy(&temp2_llong, mem2, sizeof(long long)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { @@ -3001,8 +3001,8 @@ diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool); - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + memcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + memcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); /* -d and !-p */ if (opts->delta_bool && !opts->percent_bool) { @@ -3101,16 +3101,16 @@ 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); + memcpy(buf, &ull_value, src_size); /* do conversion */ if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id) < 0) H5TOOLS_GOTO_ERROR(FAIL, "H5Tconvert failed"); - HDmemcpy(f_value, buf, dst_size); + memcpy(f_value, buf, dst_size); done: H5E_BEGIN_TRY @@ -3120,7 +3120,7 @@ done: H5E_END_TRY; if (buf) - HDfree(buf); + free(buf); H5TOOLS_ENDDEBUG(" "); return ret_value; @@ -3165,7 +3165,7 @@ equal_double(double value, double expected, diff_opt_t *opts) } else { /* Check bits */ - if (!HDmemcmp(&value, &expected, sizeof(double))) + if (!memcmp(&value, &expected, sizeof(double))) return TRUE; } @@ -3212,7 +3212,7 @@ equal_ldouble(long double value, long double expected, diff_opt_t *opts) } else { /* Check bits */ - if (!HDmemcmp(&value, &expected, sizeof(long double))) + if (!memcmp(&value, &expected, sizeof(long double))) return TRUE; } @@ -3258,7 +3258,7 @@ equal_float(float value, float expected, diff_opt_t *opts) } else { /* Check bits */ - if (!HDmemcmp(&value, &expected, sizeof(float))) + if (!memcmp(&value, &expected, sizeof(float))) return TRUE; } @@ -3493,15 +3493,15 @@ 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)); - HDmemset(members->m[u], 0, sizeof(mcomp_t)); + members->m[u] = (mcomp_t *)malloc(sizeof(mcomp_t)); + memset(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 aa64fa5..0dbaee1 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 b5c3290..c30532b 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,29 +520,29 @@ 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; } /* the stripmine loop */ - HDmemset(hs_offset1, 0, sizeof hs_offset1); - HDmemset(hs_stride1, 0, sizeof hs_stride1); - HDmemset(hs_count1, 0, sizeof hs_count1); - HDmemset(hs_block1, 0, sizeof hs_block1); - HDmemset(hs_size1, 0, sizeof hs_size1); - HDmemset(hs_offset2, 0, sizeof hs_offset2); - HDmemset(hs_stride2, 0, sizeof hs_stride2); - HDmemset(hs_count2, 0, sizeof hs_count2); - HDmemset(hs_block2, 0, sizeof hs_block2); - HDmemset(hs_size2, 0, sizeof hs_size2); - HDmemset(zero, 0, sizeof zero); + memset(hs_offset1, 0, sizeof hs_offset1); + memset(hs_stride1, 0, sizeof hs_stride1); + memset(hs_count1, 0, sizeof hs_count1); + memset(hs_block1, 0, sizeof hs_block1); + memset(hs_size1, 0, sizeof hs_size1); + memset(hs_offset2, 0, sizeof hs_offset2); + memset(hs_stride2, 0, sizeof hs_stride2); + memset(hs_count2, 0, sizeof hs_count2); + memset(hs_block2, 0, sizeof hs_block2); + memset(hs_size2, 0, sizeof hs_size2); + memset(zero, 0, sizeof zero); /* if subsetting was requested - initialize the subsetting variables */ H5TOOLS_DEBUG("compare by hyperslabs: opts->nelmts=%ld - opts->m_size=%ld", opts->nelmts, @@ -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/h5diff_util.c b/tools/lib/h5diff_util.c index 17b8d3c..fc74a39 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -321,7 +321,7 @@ print_found(hsize_t nfound) if (g_Parallel) parallel_print("%" PRIuHSIZE " differences found\n", nfound); else - HDfprintf(stdout, "%" PRIuHSIZE " differences found\n", nfound); + fprintf(stdout, "%" PRIuHSIZE " differences found\n", nfound); } /*----------------------------------------------------------------- diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 189aafd..58be037 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -176,7 +176,7 @@ h5tools_close(void) if (h5tools_init_g) { /* special case where only data is output to stdout */ if ((rawoutstream == NULL) && rawdatastream && (rawdatastream == stdout)) - HDfprintf(rawdatastream, "\n"); + fprintf(rawdatastream, "\n"); if (tools_func) H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream); @@ -256,13 +256,13 @@ h5tools_set_data_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawdatastream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawdatastream = f; retvalue = SUCCEED; } @@ -304,13 +304,13 @@ h5tools_set_attr_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawattrstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawattrstream = f; retvalue = SUCCEED; } @@ -352,13 +352,13 @@ h5tools_set_input_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "rb")) != NULL) { + if ((f = fopen(fname, "rb")) != NULL) { rawinstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "r")) != NULL) { + if ((f = fopen(fname, "r")) != NULL) { rawinstream = f; retvalue = SUCCEED; } @@ -400,13 +400,13 @@ h5tools_set_output_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawoutstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawoutstream = f; retvalue = SUCCEED; } @@ -448,13 +448,13 @@ h5tools_set_error_file(const char *fname, int is_bin) if (fname != NULL) { /* binary output */ if (is_bin) { - if ((f = HDfopen(fname, "wb")) != NULL) { + if ((f = fopen(fname, "wb")) != NULL) { rawerrorstream = f; retvalue = SUCCEED; } } else { - if ((f = HDfopen(fname, "w")) != NULL) { + if ((f = fopen(fname, "w")) != NULL) { rawerrorstream = f; retvalue = SUCCEED; } @@ -1230,8 +1230,8 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context H5TOOLS_START_DEBUG(" "); - HDmemset(&prefix, 0, sizeof(h5tools_str_t)); - HDmemset(&str, 0, sizeof(h5tools_str_t)); + memset(&prefix, 0, sizeof(h5tools_str_t)); + memset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ H5TOOLS_DEBUG("before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, @@ -1325,8 +1325,8 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_ if (!ctx->need_prefix) return; - HDmemset(&prefix, 0, sizeof(h5tools_str_t)); - HDmemset(&str, 0, sizeof(h5tools_str_t)); + memset(&prefix, 0, sizeof(h5tools_str_t)); + memset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ if (ctx->cur_column) { @@ -1843,7 +1843,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t s = (char *)mem; } for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); + memcpy(&tempuchar, &s[i], sizeof(unsigned char)); if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream)) H5TOOLS_THROW((-1), "fwrite failed"); } /* i */ @@ -1947,11 +1947,11 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t if (size > sizeof(tref)) H5TOOLS_THROW((-1), "unexpectedly large ref"); - HDmemset(&tref, 0, sizeof(tref)); + memset(&tref, 0, sizeof(tref)); for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char *)_mem) + block_index * size; - HDmemcpy(&tref, mem, size); + memcpy(&tref, mem, size); if ((region_id = H5Ropen_object(&tref, H5P_DEFAULT, H5P_DEFAULT)) < 0) H5TOOLS_INFO("H5Ropen_object H5T_STD_REF failed"); else { @@ -2044,7 +2044,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 */ @@ -2061,15 +2061,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++) { @@ -2094,10 +2094,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"); @@ -2143,7 +2143,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) @@ -2157,7 +2157,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"); @@ -2203,11 +2203,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; @@ -2223,8 +2223,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 57a1712..f7298cb 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -266,7 +266,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_cont } /* end if */ else { /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); size = H5Tget_size(type); H5TOOLS_DEBUG("type size is %ld", size); @@ -344,9 +344,9 @@ h5tools_dump_region_attribute(hid_t region_id, FILE *stream, const h5tool_format hbool_t past_catch = FALSE; hbool_t ret_value = TRUE; - HDassert(info); - HDassert(ctx); - HDassert(buffer); + assert(info); + assert(ctx); + assert(buffer); outputformat = *info; outputformat.idx_fmt = ""; @@ -497,12 +497,12 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for void *region_buf = NULL; int ret_value = 0; - HDassert(info); - HDassert(cur_ctx); - HDassert(buffer); - HDassert(ptdata); + assert(info); + assert(cur_ctx); + assert(buffer); + assert(ptdata); - HDmemset(&ctx, 0, sizeof(ctx)); + memset(&ctx, 0, sizeof(ctx)); H5TOOLS_START_DEBUG(" "); @@ -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"); @@ -674,9 +674,9 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea hbool_t past_catch = FALSE; hbool_t ret_value = TRUE; - HDassert(info); - HDassert(ctx); - HDassert(buffer); + assert(info); + assert(ctx); + assert(buffer); H5TOOLS_START_DEBUG(" "); outputformat = *info; @@ -712,8 +712,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *strea h5tools_str_append(buffer, "REGION_TYPE BLOCK "); alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - if ((ptdata = (hsize_t *)HDmalloc((size_t)alloc_size)) == NULL) + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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"); @@ -893,17 +893,17 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stre hbool_t past_catch = FALSE; int ret_value = 0; - HDassert(info); - HDassert(cur_ctx); - HDassert(buffer); - HDassert(ptdata); - HDassert(ndims > 0); + assert(info); + assert(cur_ctx); + assert(buffer); + assert(ptdata); + assert(ndims > 0); H5TOOLS_START_DEBUG(" "); - HDmemset(&ctx, 0, sizeof(ctx)); + memset(&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"); @@ -1033,9 +1033,9 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea hbool_t past_catch = FALSE; hbool_t ret_value = TRUE; - HDassert(info); - HDassert(ctx); - HDassert(buffer); + assert(info); + assert(ctx); + assert(buffer); H5TOOLS_START_DEBUG(" "); outputformat = *info; @@ -1071,8 +1071,8 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, FILE *strea h5tools_str_append(buffer, "REGION_TYPE POINT "); alloc_size = npoints * ndims * sizeof(ptdata[0]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - if (NULL == (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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"); @@ -1317,11 +1317,11 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c size = 1; sm_size[i - 1] = MIN(total_size[i - 1], size); sm_nbytes *= sm_size[i - 1]; - HDassert(sm_nbytes > 0); + assert(sm_nbytes > 0); } - HDassert(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))) + assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ + 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; @@ -1699,8 +1699,8 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont if (!sm_nbytes) goto done; - HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ - if (NULL != (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) { + assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ + 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; @@ -1710,8 +1710,8 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); /* The stripmine loop */ - HDmemset(hs_offset, 0, sizeof hs_offset); - HDmemset(zero, 0, sizeof zero); + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { H5TOOLS_DEBUG("stripmine read loop:%d", i); @@ -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: @@ -1848,8 +1848,8 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte vl_data = TRUE; alloc_size = p_nelmts * H5Tget_size(p_type); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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) @@ -1909,7 +1909,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t * stream = rawoutstream; if (!info) { - HDmemset(&info_dflt, 0, sizeof info_dflt); + memset(&info_dflt, 0, sizeof info_dflt); info = &info_dflt; } @@ -1985,7 +1985,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c stream = rawoutstream; if (!info) { - HDmemset(&info_dflt, 0, sizeof(info_dflt)); + memset(&info_dflt, 0, sizeof(info_dflt)); info = &info_dflt; } @@ -2747,7 +2747,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i if ((snmembs = H5Tget_nmembers(type)) < 0) H5TOOLS_THROW((-1), "H5Tget_nmembers failed"); nmembs = (unsigned)snmembs; - HDassert(nmembs > 0); + assert(nmembs > 0); if ((super = H5Tget_super(type)) < 0) H5TOOLS_THROW((-1), "H5Tget_super failed"); @@ -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++) { @@ -2820,13 +2820,13 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i else if (H5T_SGN_NONE == H5Tget_sign(native)) { unsigned long long copy; - HDmemcpy(©, value + i * dst_size, sizeof(copy)); + memcpy(©, value + i * dst_size, sizeof(copy)); h5tools_str_append(buffer, "%llu", copy); } else { long long copy; - HDmemcpy(©, value + i * dst_size, sizeof(copy)); + memcpy(©, value + i * dst_size, sizeof(copy)); h5tools_str_append(buffer, "%lld", copy); } @@ -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"); @@ -2879,7 +2879,7 @@ h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -2925,7 +2925,7 @@ h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_contex */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -2972,7 +2972,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -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); } /*------------------------------------------------------------------------- @@ -3130,7 +3130,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_t buffer; /* string into which to render */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -3382,12 +3382,12 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * ctx->indent_level++; ssize_out = H5Pget_virtual_filename(dcpl_id, curr_vmap, NULL, 0); - HDassert(ssize_out > 0); - HDassert((size_t)ssize_out < sizeof(name)); + assert(ssize_out > 0); + assert((size_t)ssize_out < sizeof(name)); H5Pget_virtual_filename(dcpl_id, curr_vmap, name, sizeof(name)); ssize_out = H5Pget_virtual_dsetname(dcpl_id, curr_vmap, NULL, 0); - HDassert(ssize_out > 0); - HDassert((size_t)ssize_out < sizeof(name)); + assert(ssize_out > 0); + assert((size_t)ssize_out < sizeof(name)); H5Pget_virtual_dsetname(dcpl_id, curr_vmap, dsetname, sizeof(dsetname)); ctx->need_prefix = TRUE; @@ -3661,7 +3661,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; case H5D_FILL_TIME_ERROR: default: - HDassert(0); + assert(0); break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -3685,7 +3685,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; case H5D_FILL_VALUE_ERROR: default: - HDassert(0); + assert(0); break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -3727,7 +3727,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * case H5D_ALLOC_TIME_ERROR: case H5D_ALLOC_TIME_DEFAULT: default: - HDassert(0); + assert(0); break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -3774,7 +3774,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_ return; /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -3783,7 +3783,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) { @@ -3798,7 +3798,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_ h5tools_str_close(&buffer); } - HDfree(comment); + free(comment); } } } /* end dump_comment() */ @@ -3826,7 +3826,7 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -3968,7 +3968,7 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool size_t ncols = 80; /* available output width */ /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -4063,7 +4063,7 @@ h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_contex /* Assume entire data space to be printed */ datactx.need_prefix = TRUE; - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); for (i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ @@ -4296,7 +4296,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * H5TOOLS_START_DEBUG(" file=%p", (void *)stream); H5TOOLS_DEBUG("rawdata file=%p", (void *)rawdatastream); /* setup */ - HDmemset(&buffer, 0, sizeof(h5tools_str_t)); + memset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -4357,23 +4357,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_filters.c b/tools/lib/h5tools_filters.c index 899b7be..58a71b3 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -20,7 +20,7 @@ static void print_filter_warning(const char *dname, const char *fname) { - HDfprintf(stderr, "Warning: dataset <%s> cannot be read, %s filter is not available\n", dname, fname); + fprintf(stderr, "Warning: dataset <%s> cannot be read, %s filter is not available\n", dname, fname); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 9f12367..2d95732 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); } @@ -112,7 +112,7 @@ ref_path_table_cmp(const void *key1, const void *key2) if (thefile > 0) H5Otoken_cmp(thefile, token1, token2, &cmp_value); else - cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + cmp_value = memcmp(token1, token2, sizeof(H5O_token_t)); return cmp_value; } @@ -211,7 +211,7 @@ ref_path_table_lookup(const char *thepath, H5O_token_t *token) return -1; /* Return object token through parameter */ - HDmemcpy(token, &oi.token, sizeof(H5O_token_t)); + memcpy(token, &oi.token, sizeof(H5O_token_t)); return 0; } @@ -239,10 +239,10 @@ 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)); + memcpy(&new_node->obj_token, token, sizeof(H5O_token_t)); new_node->path = HDstrdup(path); return (H5SL_insert(ref_path_table, new_node, &(new_node->obj_token))); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 208e33a..3f38805 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -64,8 +64,8 @@ void h5tools_str_close(h5tools_str_t *str) { if (str && str->nalloc) { - HDfree(str->s); - HDmemset(str, 0, sizeof(h5tools_str_t)); + free(str->s); + memset(str, 0, sizeof(h5tools_str_t)); } } @@ -122,9 +122,9 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) int nchars = -1; size_t avail = str->nalloc - str->len; - HDva_start(ap, fmt); + va_start(ap, fmt); nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap); - HDva_end(ap); + va_end(ap); /* Note: HDvsnprintf() behaves differently on Windows as Unix, when * buffer is smaller than source string. On Unix, this function @@ -149,9 +149,9 @@ h5tools_str_append(h5tools_str_t *str /*in,out*/, const char *fmt, ...) * Allocate at least twice as much space and try again. */ size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc); - HDassert(newsize > str->nalloc); /*overflow*/ - str->s = (char *)HDrealloc(str->s, newsize); - HDassert(str->s); + assert(newsize > str->nalloc); /*overflow*/ + str->s = (char *)realloc(str->s, newsize); + assert(str->s); str->nalloc = newsize; } else { @@ -183,8 +183,8 @@ 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); - HDassert(str->s); + str->s = (char *)malloc(str->nalloc); + assert(str->s); } str->s[0] = '\0'; @@ -238,8 +238,8 @@ h5tools_str_fmt(h5tools_str_t *str /*in,out*/, size_t start, const char *fmt) { char _temp[1024], *temp = _temp; - HDassert(str); - HDassert(fmt); + assert(str); + assert(fmt); /* If the format string is simply "%s" then don't bother doing anything */ if (!HDstrcmp(fmt, "%s")) @@ -253,8 +253,8 @@ 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); - HDassert(temp); + temp = (char *)malloc(n); + assert(temp); } HDstrncpy(temp, str->s + start, n - 1); @@ -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; } @@ -471,8 +471,8 @@ 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]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata = (hsize_t *)HDmalloc((size_t)alloc_size); + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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) */ } @@ -532,8 +532,8 @@ 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]); - HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - ptdata = (hsize_t *)HDmalloc((size_t)alloc_size); + assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ + 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) */ } @@ -716,21 +716,21 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */ float tempfloat; - HDmemcpy(&tempfloat, vp, sizeof(float)); + memcpy(&tempfloat, vp, sizeof(float)); h5tools_str_append(str, OPT(info->fmt_float, "%g"), (double)tempfloat); } else if (sizeof(double) == nsize) { /* if (H5Tequal(type, H5T_NATIVE_DOUBLE)) */ double tempdouble; - HDmemcpy(&tempdouble, vp, sizeof(double)); + memcpy(&tempdouble, vp, sizeof(double)); h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); } else if (sizeof(long double) == nsize) { /* if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) */ long double templdouble; - HDmemcpy(&templdouble, vp, sizeof(long double)); + memcpy(&templdouble, vp, sizeof(long double)); h5tools_str_append(str, "%Lg", templdouble); } else { @@ -830,7 +830,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else if (H5T_SGN_NONE == nsign) { unsigned char tempuchar; - HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); + memcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned char)) tempuchar = 0; @@ -844,7 +844,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { signed char tempchar; - HDmemcpy(&tempchar, cp_vp, sizeof(char)); + memcpy(&tempchar, cp_vp, sizeof(char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(char)) tempchar = 0; @@ -860,7 +860,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (H5T_SGN_NONE == nsign) { unsigned int tempuint; - HDmemcpy(&tempuint, vp, sizeof(unsigned int)); + memcpy(&tempuint, vp, sizeof(unsigned int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned int)) tempuint = 0; @@ -872,7 +872,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { int tempint; - HDmemcpy(&tempint, vp, sizeof(int)); + memcpy(&tempint, vp, sizeof(int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(int)) tempint = 0; @@ -887,7 +887,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (H5T_SGN_NONE == nsign) { unsigned short tempushort; - HDmemcpy(&tempushort, vp, sizeof(unsigned short)); + memcpy(&tempushort, vp, sizeof(unsigned short)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned short)) tempushort = 0; @@ -901,7 +901,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { short tempshort; - HDmemcpy(&tempshort, vp, sizeof(short)); + memcpy(&tempshort, vp, sizeof(short)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(short)) tempshort = 0; @@ -916,7 +916,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (H5T_SGN_NONE == nsign) { unsigned long tempulong; - HDmemcpy(&tempulong, vp, sizeof(unsigned long)); + memcpy(&tempulong, vp, sizeof(unsigned long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long)) tempulong = 0; @@ -928,7 +928,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { long templong; - HDmemcpy(&templong, vp, sizeof(long)); + memcpy(&templong, vp, sizeof(long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long)) templong = 0; @@ -944,7 +944,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (H5T_SGN_NONE == nsign) { unsigned long long tempullong; - HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); + memcpy(&tempullong, vp, sizeof(unsigned long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long long)) tempullong = 0; @@ -956,7 +956,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else { long long templlong; - HDmemcpy(&templlong, vp, sizeof(long long)); + memcpy(&templlong, vp, sizeof(long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long long)) templlong = 0; @@ -1271,13 +1271,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai size = H5Tget_size(memb); ndims = H5Tget_array_ndims(type); H5Tget_array_dims2(type, dims); - HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK); + assert(ndims >= 1 && ndims <= H5S_MAX_RANK); /* Calculate the number of array elements */ for (k = 0, nelmts = 1; k < ndims; k++) { temp_nelmts = nelmts; temp_nelmts *= dims[k]; - HDassert(temp_nelmts == (hsize_t)((size_t)temp_nelmts)); + assert(temp_nelmts == (hsize_t)((size_t)temp_nelmts)); nelmts = (size_t)temp_nelmts; } /* Print the opening bracket */ @@ -1446,38 +1446,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, "\""); @@ -1563,7 +1563,7 @@ h5tools_escape(char *s /*in,out*/, size_t size) return NULL; HDmemmove(s + i + esc_size, s + i + 1, n - i); /*make room*/ - HDmemcpy(s + i, escape, esc_size); /*insert*/ + memcpy(s + i, escape, esc_size); /*insert*/ n += esc_size - 1; /* adjust total string size */ i += esc_size; /* adjust string position */ } @@ -1626,20 +1626,20 @@ 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)); - HDmemcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement)); - HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), - HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr)); - HDmemset(newstr + HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement), 0, 1); + memcpy(newstr, oldstr, (size_t)(tok - oldstr)); + memcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement)); + memcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), + HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr)); + memset(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 8a9d806..652dafa 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -65,15 +65,15 @@ parallel_print(const char *format, ...) int bytes_written; va_list ap; - HDva_start(ap, format); + va_start(ap, format); if (!g_Parallel) HDvprintf(format, ap); else { if (overflow_file == NULL) /*no overflow has occurred yet */ { bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap); - HDva_end(ap); - HDva_start(ap, format); + va_end(ap); + va_start(ap, format); if ((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) { /* Terminate the outbuff at the end of the previous output */ @@ -81,8 +81,8 @@ parallel_print(const char *format, ...) overflow_file = HDtmpfile(); if (overflow_file == NULL) - HDfprintf(rawerrorstream, - "warning: could not create overflow file. Output may be truncated.\n"); + fprintf(rawerrorstream, + "warning: could not create overflow file. Output may be truncated.\n"); else bytes_written = HDvfprintf(overflow_file, format, ap); } @@ -92,7 +92,7 @@ parallel_print(const char *format, ...) else bytes_written = HDvfprintf(overflow_file, format, ap); } - HDva_end(ap); + va_end(ap); } /*------------------------------------------------------------------------- @@ -109,14 +109,14 @@ error_msg(const char *fmt, ...) { va_list ap; - HDva_start(ap, fmt); + va_start(ap, fmt); FLUSHSTREAM(rawattrstream); FLUSHSTREAM(rawdatastream); FLUSHSTREAM(rawoutstream); - HDfprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); + fprintf(rawerrorstream, "%s error: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); - HDva_end(ap); + va_end(ap); } /*------------------------------------------------------------------------- @@ -133,13 +133,13 @@ warn_msg(const char *fmt, ...) { va_list ap; - HDva_start(ap, fmt); + va_start(ap, fmt); FLUSHSTREAM(rawattrstream); FLUSHSTREAM(rawdatastream); FLUSHSTREAM(rawoutstream); - HDfprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); + fprintf(rawerrorstream, "%s warning: ", h5tools_getprogname()); HDvfprintf(rawerrorstream, fmt, ap); - HDva_end(ap); + va_end(ap); } /*------------------------------------------------------------------------- @@ -153,8 +153,8 @@ warn_msg(const char *fmt, ...) void help_ref_msg(FILE *output) { - HDfprintf(output, "Try '-h' or '--help' for more information or "); - HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n", h5tools_getprogname()); + fprintf(output, "Try '-h' or '--help' for more information or "); + fprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n", h5tools_getprogname()); } /*------------------------------------------------------------------------- @@ -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; @@ -508,8 +508,8 @@ indentation(unsigned x) PRINTVALSTREAM(rawoutstream, " "); } else { - HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); - HDexit(1); + fprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); + exit(1); } } @@ -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,14 +780,14 @@ 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 */ u = table->nobjs++; /* Set information about object */ - HDmemcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t)); + memcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t)); table->objs[u].objname = HDstrdup(objname); table->objs[u].recorded = record; table->objs[u].displayed = 0; @@ -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); @@ -930,7 +930,7 @@ H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t } /* end if */ /* set target obj type to return */ - HDmemcpy(&link_info->obj_token, &trg_oinfo.token, sizeof(H5O_token_t)); + memcpy(&link_info->obj_token, &trg_oinfo.token, sizeof(H5O_token_t)); link_info->trg_type = trg_oinfo.type; link_info->fileno = trg_oinfo.fileno; } /* end if */ @@ -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; } @@ -1130,19 +1130,19 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values) /* e.g.? if (!populate()) { then failed } */ if (show_progress) { - HDprintf("called h5tools_populate_ros3_fapl\n"); + printf("called h5tools_populate_ros3_fapl\n"); } if (fa == NULL) { if (show_progress) { - HDprintf(" ERROR: null pointer to fapl_t\n"); + printf(" ERROR: null pointer to fapl_t\n"); } ret_value = 0; goto done; } if (show_progress) { - HDprintf(" preset fapl with default values\n"); + printf(" preset fapl with default values\n"); } fa->version = H5FD_CURR_ROS3_FAPL_T_VERSION; fa->authenticate = FALSE; @@ -1155,21 +1155,21 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values) if (values != NULL) { if (values[0] == NULL) { if (show_progress) { - HDprintf(" ERROR: aws_region value cannot be NULL\n"); + printf(" ERROR: aws_region value cannot be NULL\n"); } ret_value = 0; goto done; } if (values[1] == NULL) { if (show_progress) { - HDprintf(" ERROR: secret_id value cannot be NULL\n"); + printf(" ERROR: secret_id value cannot be NULL\n"); } ret_value = 0; goto done; } if (values[2] == NULL) { if (show_progress) { - HDprintf(" ERROR: secret_key value cannot be NULL\n"); + printf(" ERROR: secret_key value cannot be NULL\n"); } ret_value = 0; goto done; @@ -1181,48 +1181,48 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values) if (*values[0] != '\0' && *values[1] != '\0') { if (HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN) { if (show_progress) { - HDprintf(" ERROR: aws_region value too long\n"); + printf(" ERROR: aws_region value too long\n"); } ret_value = 0; goto done; } - HDmemcpy(fa->aws_region, values[0], (HDstrlen(values[0]) + 1)); + memcpy(fa->aws_region, values[0], (HDstrlen(values[0]) + 1)); if (show_progress) { - HDprintf(" aws_region set\n"); + printf(" aws_region set\n"); } if (HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN) { if (show_progress) { - HDprintf(" ERROR: secret_id value too long\n"); + printf(" ERROR: secret_id value too long\n"); } ret_value = 0; goto done; } - HDmemcpy(fa->secret_id, values[1], (HDstrlen(values[1]) + 1)); + memcpy(fa->secret_id, values[1], (HDstrlen(values[1]) + 1)); if (show_progress) { - HDprintf(" secret_id set\n"); + printf(" secret_id set\n"); } if (HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN) { if (show_progress) { - HDprintf(" ERROR: secret_key value too long\n"); + printf(" ERROR: secret_key value too long\n"); } ret_value = 0; goto done; } - HDmemcpy(fa->secret_key, values[2], (HDstrlen(values[2]) + 1)); + memcpy(fa->secret_key, values[2], (HDstrlen(values[2]) + 1)); if (show_progress) { - HDprintf(" secret_key set\n"); + printf(" secret_key set\n"); } fa->authenticate = TRUE; if (show_progress) { - HDprintf(" set to authenticate\n"); + printf(" set to authenticate\n"); } } else if (*values[0] != '\0' || *values[1] != '\0' || *values[2] != '\0') { if (show_progress) { - HDprintf(" ERROR: invalid assortment of empty/non-empty values\n"); + printf(" ERROR: invalid assortment of empty/non-empty values\n"); } ret_value = 0; goto done; @@ -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 564dcba..6b3ad0a 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -121,12 +121,12 @@ trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path) 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 */ idx = visited->nused++; - HDmemcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t)); + memcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t)); visited->objs[idx].path = HDstrdup(path); } /* end trav_token_add() */ @@ -178,7 +178,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); @@ -196,7 +196,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 */ @@ -211,7 +211,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 */ @@ -220,13 +220,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() */ @@ -296,8 +296,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 */ @@ -323,7 +323,7 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) 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 */ @@ -356,7 +356,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id) else H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC); - HDmemcpy(&info->paths[idx].obj_token, &oinfo.token, sizeof(H5O_token_t)); + memcpy(&info->paths[idx].obj_token, &oinfo.token, sizeof(H5O_token_t)); info->paths[idx].fileno = oinfo.fileno; } /* end trav_fileinfo_add() */ @@ -383,7 +383,7 @@ trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo, const char H5_AT /* set object addr and fileno. These are for checking same object */ info_p = (trav_info_t *)udata; idx = info_p->nused - 1; - HDmemcpy(&info_p->paths[idx].obj_token, &oinfo->token, sizeof(H5O_token_t)); + memcpy(&info_p->paths[idx].obj_token, &oinfo->token, sizeof(H5O_token_t)); info_p->paths[idx].fileno = oinfo->fileno; return (0); @@ -476,7 +476,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; @@ -507,16 +507,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() */ @@ -655,12 +655,12 @@ 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++; if (oinfo) - HDmemcpy(&table->objs[new_obj].obj_token, &oinfo->token, sizeof(H5O_token_t)); + memcpy(&table->objs[new_obj].obj_token, &oinfo->token, sizeof(H5O_token_t)); else /* Set token to 'undefined' values */ table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF; @@ -702,7 +702,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 */ @@ -732,7 +732,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++; @@ -762,7 +762,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; @@ -788,19 +788,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); } } @@ -816,14 +816,14 @@ trav_attr(hid_t const char *buf = op_data->path; if ((strlen(buf) == 1) && (*buf == '/')) - HDprintf(" %-10s %s%s", "attribute", buf, attr_name); + printf(" %-10s %s%s", "attribute", buf, attr_name); else - HDprintf(" %-10s %s/%s", "attribute", buf, attr_name); + printf(" %-10s %s/%s", "attribute", buf, attr_name); #ifdef H5TRAV_PRINT_SPACE if (trav_verbosity < 2) { #endif - HDprintf("\n"); + printf("\n"); #ifdef H5TRAV_PRINT_SPACE } else { @@ -843,26 +843,26 @@ trav_attr(hid_t switch (space_type) { case H5S_SCALAR: /* scalar dataspace */ - HDprintf(" scalar\n"); + printf(" scalar\n"); break; case H5S_SIMPLE: /* simple dataspace */ - HDprintf(" {"); + printf(" {"); for (i = 0; i < ndims; i++) { - HDprintf("%s%" PRIuHSIZE, i ? ", " : "", size[i]); + printf("%s%" PRIuHSIZE, i ? ", " : "", size[i]); } - HDprintf("}\n"); + printf("}\n"); break; case H5S_NULL: /* null dataspace */ - HDprintf(" null\n"); + printf(" null\n"); break; default: /* Unknown dataspace type */ - HDprintf(" unknown\n"); + printf(" unknown\n"); break; } /* end switch */ @@ -894,22 +894,22 @@ trav_print_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *alr */ switch (oinfo->type) { case H5O_TYPE_GROUP: - HDprintf(" %-10s %s", "group", path); + printf(" %-10s %s", "group", path); break; case H5O_TYPE_DATASET: - HDprintf(" %-10s %s", "dataset", path); + printf(" %-10s %s", "dataset", path); break; case H5O_TYPE_NAMED_DATATYPE: - HDprintf(" %-10s %s", "datatype", path); + printf(" %-10s %s", "datatype", path); break; case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - HDprintf(" %-10s %s", "unknown object type", path); + printf(" %-10s %s", "unknown object type", path); break; } /* end switch */ @@ -919,14 +919,14 @@ trav_print_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *alr op_data.path = path; /* Finish printing line about object */ - HDprintf("\n"); + printf("\n"); if (trav_verbosity > 0) H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, &op_data, H5P_DEFAULT); } else /* Print the link's original name */ - HDprintf(" -> %s\n", already_visited); + printf(" -> %s\n", already_visited); return (0); } /* end trav_print_visit_obj() */ @@ -949,16 +949,16 @@ 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; - HDprintf(" %-10s %s -> %s\n", "link", path, targbuf); - HDfree(targbuf); + printf(" %-10s %s -> %s\n", "link", path, targbuf); + free(targbuf); } } /* end if */ else - HDprintf(" %-10s %s ->\n", "link", path); + printf(" %-10s %s ->\n", "link", path); break; case H5L_TYPE_EXTERNAL: @@ -967,17 +967,17 @@ 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) - HDprintf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); - HDfree(targbuf); + printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); + free(targbuf); } } /* end if */ else - HDprintf(" %-10s %s ->\n", "ext link", path); + printf(" %-10s %s ->\n", "ext link", path); break; case H5L_TYPE_HARD: @@ -987,7 +987,7 @@ trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata) case H5L_TYPE_ERROR: case H5L_TYPE_MAX: default: - HDprintf(" %-10s %s -> ???\n", "unknown type of UD link", path); + printf(" %-10s %s -> ???\n", "unknown type of UD link", path); break; } /* end switch() */ @@ -1075,7 +1075,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 */ @@ -1097,7 +1097,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 49a4a20..455e28a 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; } @@ -125,7 +125,7 @@ io_time_t * io_time_set(io_time_t *pt, timer_type t, int start_stop) { /* sanity check */ - HDassert(pt); + assert(pt); switch (pt->type) { #ifdef H5_HAVE_PARALLEL @@ -158,7 +158,7 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) break; #else case MPI_CLOCK: - HDfprintf(stderr, "MPI clock set in serial library\n"); + fprintf(stderr, "MPI clock set in serial library\n"); return NULL; #endif /* H5_HAVE_PARALLEL */ case SYS_CLOCK: @@ -192,7 +192,7 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop) break; default: - HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type); + fprintf(stderr, "Unknown time clock type (%d)\n", pt->type); return NULL; } /* end switch */ @@ -214,7 +214,7 @@ H5_ATTR_PURE double io_time_get(io_time_t *pt, timer_type t) { /* sanity check */ - HDassert(pt); + assert(pt); return pt->total_time[t]; } |