diff options
Diffstat (limited to 'tools/src/h5repack')
-rw-r--r-- | tools/src/h5repack/h5repack.c | 20 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 16 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_opttable.c | 12 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_parse.c | 50 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_refs.c | 95 |
5 files changed, 96 insertions, 97 deletions
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 5c95b06..a6d83ea 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -132,7 +132,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) n = options->n_filter_g++; /* increase # of global filters */ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg("maximum number of filters exceeded for <%s>\n", str); - HDfree(obj_list); + free(obj_list); return -1; } @@ -141,7 +141,7 @@ h5repack_addfilter(const char *str, pack_opt_t *options) else options_add_filter(obj_list, n_objs, filter, options->op_tbl); - HDfree(obj_list); + free(obj_list); return 0; } /* end h5repack_addfilter() */ @@ -195,7 +195,7 @@ h5repack_addlayout(const char *str, pack_opt_t *options) if (options->all_layout == 0) ret_value = options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - HDfree(obj_list); + free(obj_list); ret_value = 0; } /* end if obj_list exists */ @@ -253,7 +253,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t for (i = 0; i < travt->nobjs; i++) { if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ - if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; @@ -276,7 +276,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t */ if (!dt_ret) { /* Push the new datatype onto the stack */ - if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) + if (NULL == (dt_ret = (named_dt_t *)malloc(sizeof(named_dt_t)))) H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "buffer allocation failed failed"); dt_ret->next = *named_dt_head_p; *named_dt_head_p = dt_ret; @@ -330,7 +330,7 @@ named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) if (H5Tclose(dt->id_out) < 0 && !ignore_err) H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed"); dt = dt->next; - HDfree(*named_dt_head_p); + free(*named_dt_head_p); *named_dt_head_p = dt; } @@ -481,9 +481,9 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ *----------------------------------------------------------------- */ - buf = (void *)HDmalloc((size_t)(nelmts * msize)); + buf = (void *)malloc((size_t)(nelmts * msize)); if (buf == NULL) { - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); } /* end if */ if (options->verbose == 2) { H5_timer_init(&timer); @@ -526,7 +526,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ if (TRUE == h5tools_detect_vlen(wtype_id)) H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); - HDfree(buf); + free(buf); buf = NULL; } /*H5T_REFERENCE*/ @@ -566,7 +566,7 @@ done: H5Treclaim(wtype_id, space_id, H5P_DEFAULT, buf); /* Free buf */ - HDfree(buf); + free(buf); } H5Aclose(attr_out); diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 8b11974..be3fddf 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -1012,7 +1012,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* have to read the whole dataset if there is only one element in the * dataset */ if (need < H5TOOLS_MALLOCSIZE) - buf = HDmalloc(need); + buf = malloc(need); /* Set up collective write if using filters in parallel */ { @@ -1061,7 +1061,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ - HDfree(buf); + free(buf); buf = NULL; } } @@ -1108,7 +1108,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti &hslab_nbytes) < 0) H5TOOLS_GOTO_ERROR((-1), "get_hyperslab failed"); - hslab_buf = HDmalloc((size_t)hslab_nbytes); + hslab_buf = malloc((size_t)hslab_nbytes); if (hslab_buf == NULL) H5TOOLS_GOTO_ERROR((-1), "can't allocate space for hyperslab"); @@ -1189,7 +1189,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5Sclose(hslab_space); if (hslab_buf != NULL) { - HDfree(hslab_buf); + free(hslab_buf); hslab_buf = NULL; } } /* end if reading/writing by hyperslab */ @@ -1421,7 +1421,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); linkinfo.trg_path = NULL; } /* options->merge */ else { @@ -1460,7 +1460,7 @@ done: /* free link info path */ if (linkinfo.trg_path) - HDfree(linkinfo.trg_path); + free(linkinfo.trg_path); H5E_BEGIN_TRY { @@ -1484,9 +1484,9 @@ done: /* free */ if (buf != NULL) - HDfree(buf); + free(buf); if (hslab_buf != NULL) - HDfree(hslab_buf); + free(hslab_buf); return ret_value; } /* end do_copy_objects() */ diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 4e6e0f4..64f3011 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -104,7 +104,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) int ret_value = 0; table->size += n_objs; - table->objs = (pack_info_t *)HDrealloc(table->objs, table->size * sizeof(pack_info_t)); + table->objs = (pack_info_t *)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { H5TOOLS_INFO("not enough memory for options table"); ret_value = -1; @@ -132,14 +132,14 @@ options_table_init(pack_opttbl_t **tbl) pack_opttbl_t *table; int ret_value = 0; - if (NULL == (table = (pack_opttbl_t *)HDmalloc(sizeof(pack_opttbl_t)))) { + if (NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t)))) { H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } table->size = 30; table->nelems = 0; - if (NULL == (table->objs = (pack_info_t *)HDmalloc(table->size * sizeof(pack_info_t)))) { - HDfree(table); + if (NULL == (table->objs = (pack_info_t *)malloc(table->size * sizeof(pack_info_t)))) { + free(table); H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table"); } @@ -163,8 +163,8 @@ done: int options_table_free(pack_opttbl_t *table) { - HDfree(table->objs); - HDfree(table); + free(table->objs); + free(table); return 0; } diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c index cee85ac..d4fa990 100644 --- a/tools/src/h5repack/h5repack_parse.c +++ b/tools/src/h5repack/h5repack_parse.c @@ -77,7 +77,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t else *n_objs = n; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -103,7 +103,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("input Error: Invalid compression type in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -134,7 +134,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter not digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -184,7 +184,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -244,13 +244,13 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c) && l == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter number parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } else if (!HDisdigit(c) && f == -1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("filter flag parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -269,7 +269,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t c = str[u]; if (!HDisdigit(c)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("compression parameter is not a digit in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -312,7 +312,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 1; if (no_param) { /*no more parameters, GZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -327,7 +327,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SZIP must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -342,7 +342,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in SHUF <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -356,7 +356,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*shuffle does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in FLET <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -370,7 +370,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 0; if (m > 0) { /*nbit does not have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("extra parameter in NBIT <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -384,7 +384,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t filt->cd_nelmts = 2; if (no_param) { /*no more parameters, SOFF must have parameter */ if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("missing compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -397,14 +397,14 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t /* parameters does not match count */ if (filt->cd_nelmts != j) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("incorrect number of compression parameters in <%s>\n", str); HDexit(EXIT_FAILURE); } } else { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid filter type in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -425,7 +425,7 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t case H5Z_FILTER_DEFLATE: if (filt->cd_values[0] > 9) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("invalid compression parameter in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -438,19 +438,19 @@ parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt, pack_opt_t pixels_per_block = filt->cd_values[0]; if ((pixels_per_block % 2) == 1) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is not even in <%s>\n", str); HDexit(EXIT_FAILURE); } if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("pixels_per_block is too large in <%s>\n", str); HDexit(EXIT_FAILURE); } if ((HDstrcmp(smask, "NN") != 0) && (HDstrcmp(smask, "EC") != 0)) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("szip mask must be 'NN' or 'EC' \n"); HDexit(EXIT_FAILURE); } @@ -514,7 +514,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about } n++; - obj_list = (obj_list_t *)HDmalloc(n * sizeof(obj_list_t)); + obj_list = (obj_list_t *)malloc(n * sizeof(obj_list_t)); if (obj_list == NULL) { error_msg("could not allocate object list\n"); return NULL; @@ -541,7 +541,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about /* nothing after : */ if (end_obj + 1 == (int)len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, no characters after : in <%s>\n", str); HDexit(EXIT_FAILURE); } @@ -575,7 +575,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about k = 0; if (j > len) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Chunk dimensions missing\n", str); HDexit(EXIT_FAILURE); } @@ -587,7 +587,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about if (!HDisdigit(c) && c != 'x' && c != 'N' && c != 'O' && c != 'N' && c != 'E') { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> Not a valid character in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } @@ -599,7 +599,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } @@ -615,7 +615,7 @@ parse_layout(const char *str, unsigned *n_objs, pack_info_t *pack, /* info about pack->chunk.chunk_lengths[c_index] = HDstrtoull(sdim, NULL, 0); if (pack->chunk.chunk_lengths[c_index] == 0) { if (obj_list) - HDfree(obj_list); + free(obj_list); error_msg("in parse layout, <%s> conversion to number in <%s>\n", sdim, str); HDexit(EXIT_FAILURE); } diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index a9a5fd3..222447d 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -152,19 +152,19 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (u = 0; u < nelmts; u++) { H5E_BEGIN_TRY { @@ -207,9 +207,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*------------------------------------------------------ * copy attrs @@ -234,11 +234,11 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti *------------------------------------------------------------------------- */ if (nelmts) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Dread failed"); @@ -246,12 +246,12 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti * create output *------------------------------------------------------------------------- */ - refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), - (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), + (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (u = 0; u < nelmts; u++) { H5E_BEGIN_TRY @@ -301,9 +301,9 @@ do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, pack_opt_t *opti H5TOOLS_GOTO_ERROR((-1), "H5Dwrite failed"); if (buf) - HDfree(buf); + free(buf); if (refbuf) - HDfree(refbuf); + free(refbuf); /*----------------------------------------------------- * copy attrs @@ -506,8 +506,8 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nmembers < 1) H5TOOLS_GOTO_ERROR((-1), "H5Tget_nmembers failed"); - ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers * sizeof(unsigned)); - ref_comp_size = (size_t *)HDmalloc((size_t)nmembers * sizeof(ref_comp_size)); + ref_comp_index = (unsigned *)malloc((size_t)nmembers * sizeof(unsigned)); + ref_comp_size = (size_t *)malloc((size_t)nmembers * sizeof(ref_comp_size)); ref_comp_field_n = 0; for (i = 0; i < (unsigned)nmembers; i++) { @@ -527,12 +527,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * statement below. */ if (!ref_comp_field_n) { if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } } @@ -598,19 +598,19 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / if (nelmts > 0) { /* handle object references */ if ((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE == msize)) { - buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hobj_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); - refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); + refbuf = (hobj_ref_t *)calloc((unsigned)nelmts, msize); if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (i = 0; i < (unsigned)nelmts; i++) if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, @@ -619,12 +619,12 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / } /* H5T_STD_REF_OBJ */ /* handle region references */ else if ((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) { - buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); + buf = (hdset_reg_ref_t *)malloc((unsigned)(nelmts * msize)); if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -632,12 +632,11 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / * create output *------------------------------------------------------------------------- */ - refbuf = - (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ + refbuf = (hdset_reg_ref_t *)calloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if (refbuf == NULL) { printf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDcalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "calloc failed"); + } for (i = 0; i < (unsigned)nelmts; i++) if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, @@ -647,13 +646,13 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_vlen) { /* handle VLEN of references */ - buf = (hvl_t *)HDmalloc((unsigned)(nelmts * sizeof(hvl_t))); + buf = (hvl_t *)malloc((unsigned)(nelmts * sizeof(hvl_t))); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -689,13 +688,13 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / else if (is_ref_comp) { /* handle ref fields in a compound */ - buf = HDmalloc((unsigned)(nelmts * msize)); + buf = malloc((unsigned)(nelmts * msize)); refbuf = buf; /* reuse the read buffer for write */ if (buf == NULL) { printf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR((-1), "HDmalloc failed"); - } /* end if */ + H5TOOLS_GOTO_ERROR((-1), "malloc failed"); + } if (H5Aread(attr_id, mtype_id, buf) < 0) H5TOOLS_GOTO_ERROR((-1), "H5Aread failed"); @@ -739,22 +738,22 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / refbuf = NULL; /* set it to NULL to avoid double free since buf and refbuf are the same. */ if (buf) { - HDfree(buf); + free(buf); buf = NULL; } if (refbuf) { - HDfree(refbuf); + free(refbuf); refbuf = NULL; } if (ref_comp_index) { - HDfree(ref_comp_index); + free(ref_comp_index); ref_comp_index = NULL; } if (ref_comp_size) { - HDfree(ref_comp_size); + free(ref_comp_size); ref_comp_size = NULL; } @@ -777,15 +776,15 @@ copy_refs_attr(hid_t loc_in, hid_t loc_out, trav_table_t *travt, hid_t fidout) / done: if (refbuf) - HDfree(refbuf); + free(refbuf); if (buf) - HDfree(buf); + free(buf); if (ref_comp_index) - HDfree(ref_comp_index); + free(ref_comp_index); if (ref_comp_size) - HDfree(ref_comp_size); + free(ref_comp_size); H5E_BEGIN_TRY { |