summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_utils.c')
-rw-r--r--tools/lib/h5tools_utils.c104
1 files changed, 52 insertions, 52 deletions
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;
}