diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-28 22:48:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 22:48:12 (GMT) |
commit | aebac33a1f290fa5065bce96bb0512317a34c283 (patch) | |
tree | cdbae6dbd65a2eb4e6f786921ee907cec92c92d3 /tools/lib/h5tools_utils.c | |
parent | 605cea4af60cfcbe03a54f697de392eec75e5a85 (diff) | |
download | hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.zip hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.gz hdf5-aebac33a1f290fa5065bce96bb0512317a34c283.tar.bz2 |
Remove HD from memory allocate/free calls (#3195)
* HDcalloc
* HDfree
* HDmalloc
* HDrealloc
Diffstat (limited to 'tools/lib/h5tools_utils.c')
-rw-r--r-- | tools/lib/h5tools_utils.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 6cc9125..dd69eb8 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -205,7 +205,7 @@ parse_hsize_list(const char *h_list, subset_d *d) H5TOOLS_DEBUG("Number integers to read=%ld", size_count); /* allocate an array for the integers in the list */ - if ((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL) + if ((p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t))) == NULL) H5TOOLS_INFO("Unable to allocate space for subset data"); for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++) @@ -247,7 +247,7 @@ parse_subset_params(const char *dset) if ((brace = HDstrrchr(q_dset, '[')) != NULL) { *brace++ = '\0'; - s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); + s = (struct subset_t *)calloc(1, sizeof(struct subset_t)); parse_hsize_list(brace, &s->start); while (*brace && *brace != ';') @@ -383,7 +383,7 @@ parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char * /* create list */ - elems = (char **)HDmalloc(sizeof(char *) * (init_slots + 1)); + elems = (char **)malloc(sizeof(char *) * (init_slots + 1)); if (elems == NULL) { ret_value = FAIL; goto done; @@ -391,8 +391,8 @@ parse_tuple(const char *start, int sep, char **cpy_out, unsigned *nelems, char * /* create destination string */ - start++; /* advance past opening paren '(' */ - cpy = (char *)HDmalloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */ + start++; /* advance past opening paren '(' */ + cpy = (char *)malloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */ if (cpy == NULL) { ret_value = FAIL; goto done; @@ -541,12 +541,12 @@ print_version(const char *progname) static void init_table(hid_t fid, table_t **tbl) { - table_t *table = (table_t *)HDmalloc(sizeof(table_t)); + table_t *table = (table_t *)malloc(sizeof(table_t)); table->fid = fid; table->size = 20; table->nobjs = 0; - table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t)); + table->objs = (obj_t *)malloc(table->size * sizeof(obj_t)); *tbl = table; } @@ -568,10 +568,10 @@ free_table(table_t *table) /* Free the names for the objects in the table */ for (u = 0; u < table->nobjs; u++) if (table->objs[u].objname) - HDfree(table->objs[u].objname); + free(table->objs[u].objname); - HDfree(table->objs); - HDfree(table); + free(table->objs); + free(table); } #ifdef H5DUMP_DEBUG @@ -701,7 +701,7 @@ find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_see add_obj(info->type_table, &oinfo->token, name, TRUE); else { /* Use latest version of name */ - HDfree(found_obj->objname); + free(found_obj->objname); found_obj->objname = HDstrdup(name); /* Mark named datatype as having valid name */ @@ -780,7 +780,7 @@ add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool /* See if we need to make table larger */ if (table->nobjs == table->size) { table->size *= 2; - table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0])); + table->objs = (struct obj_t *)realloc(table->objs, table->size * sizeof(table->objs[0])); } /* end if */ /* Increment number of objects in table */ @@ -870,7 +870,7 @@ H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t H5TOOLS_GOTO_DONE(2); /* trg_path must be freed out of this function when finished using */ - if ((link_info->trg_path = (char *)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) { + if ((link_info->trg_path = (char *)calloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) { if (link_info->opt.msg_mode == 1) parallel_print("Warning: unable to allocate buffer for <%s>\n", linkpath); H5TOOLS_GOTO_DONE(FAIL); @@ -1053,9 +1053,9 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t done: if (s3cred) - HDfree(s3cred); + free(s3cred); if (s3cred_src) - HDfree(s3cred_src); + free(s3cred_src); return ret_value; } @@ -1291,9 +1291,9 @@ h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int delim, H5FD_hdfs_fapl_t done: if (props) - HDfree(props); + free(props); if (props_src) - HDfree(props_src); + free(props_src); return ret_value; } |