summaryrefslogtreecommitdiffstats
path: root/hl/tools/h5watch
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-07-27 20:43:30 (GMT)
committerGitHub <noreply@github.com>2023-07-27 20:43:30 (GMT)
commit1e91d96fa02466ffe451319bdac1005f84dc7993 (patch)
tree4de04ef502c313dfd766497b20235188761146c0 /hl/tools/h5watch
parent95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff)
downloadhdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip
hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz
hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'hl/tools/h5watch')
-rw-r--r--hl/tools/h5watch/extend_dset.c48
-rw-r--r--hl/tools/h5watch/h5watch.c129
-rw-r--r--hl/tools/h5watch/h5watchgentest.c10
3 files changed, 93 insertions, 94 deletions
diff --git a/hl/tools/h5watch/extend_dset.c b/hl/tools/h5watch/extend_dset.c
index 97abbc6..59c5eb7 100644
--- a/hl/tools/h5watch/extend_dset.c
+++ b/hl/tools/h5watch/extend_dset.c
@@ -85,9 +85,9 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
set_t *cbuf = NULL; /* buffer for storing retrieved elements (compound) */
/* Allocate memory */
- if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
+ if (NULL == (ibuf = (int *)calloc(TEST_BUF_SIZE, sizeof(int))))
goto error;
- if (NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
+ if (NULL == (cbuf = (set_t *)calloc(TEST_BUF_SIZE, sizeof(set_t))))
goto error;
/* Create a copy of file access property list */
@@ -148,7 +148,7 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
/* Compound type */
if (!HDstrcmp(dname, DSET_CMPD_TWO)) {
- HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ memset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
for (i = 0; i < num_elmts; i++) {
cbuf[i].field1 = action1;
cbuf[i].field2.a = action1;
@@ -166,7 +166,7 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
goto error;
}
else { /* Integer type */
- HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
+ memset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
for (i = 0; i < num_elmts; i++)
ibuf[i] = action1;
@@ -189,9 +189,9 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
goto error;
if (ibuf)
- HDfree(ibuf);
+ free(ibuf);
if (cbuf)
- HDfree(cbuf);
+ free(cbuf);
return SUCCEED;
@@ -204,9 +204,9 @@ error:
H5E_END_TRY
if (ibuf)
- HDfree(ibuf);
+ free(ibuf);
if (cbuf)
- HDfree(cbuf);
+ free(cbuf);
return FAIL;
@@ -239,9 +239,9 @@ extend_dset_one(const char *file, char *dname, int action)
set_t *cbuf = NULL; /* buffer for storing retrieved elements (compound) */
/* Allocate memory */
- if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
+ if (NULL == (ibuf = (int *)calloc(TEST_BUF_SIZE, sizeof(int))))
goto error;
- if (NULL == (cbuf = (set_t *)HDcalloc(TEST_BUF_SIZE, sizeof(set_t))))
+ if (NULL == (cbuf = (set_t *)calloc(TEST_BUF_SIZE, sizeof(set_t))))
goto error;
/* Create a copy of file access property list */
@@ -307,7 +307,7 @@ extend_dset_one(const char *file, char *dname, int action)
/* Compound type */
if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
- HDmemset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
+ memset(cbuf, 0, TEST_BUF_SIZE * sizeof(set_t));
for (i = 0; i < action; i++) {
cbuf[i].field1 = i + 1;
cbuf[i].field2.a = i + 2;
@@ -328,7 +328,7 @@ extend_dset_one(const char *file, char *dname, int action)
}
else { /* Integer type */
- HDmemset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
+ memset(ibuf, 0, TEST_BUF_SIZE * sizeof(int));
for (i = 0; i < action; i++)
ibuf[i] = (int)i;
@@ -358,9 +358,9 @@ extend_dset_one(const char *file, char *dname, int action)
goto error;
if (ibuf)
- HDfree(ibuf);
+ free(ibuf);
if (cbuf)
- HDfree(cbuf);
+ free(cbuf);
return SUCCEED;
@@ -375,9 +375,9 @@ error:
H5E_END_TRY
if (ibuf)
- HDfree(ibuf);
+ free(ibuf);
if (cbuf)
- HDfree(cbuf);
+ free(cbuf);
return FAIL;
} /* end extend_dset_one() */
@@ -398,15 +398,15 @@ main(int argc, char *argv[])
int action1, action2;
if (argc != 5) {
- HDfprintf(stderr, "Should have file name, dataset name, and the extended amount...\n");
+ fprintf(stderr, "Should have file name, dataset name, and the extended amount...\n");
goto error;
} /* end if */
/* Get the dataset name to be extended */
fname = HDstrdup(argv[1]);
dname = HDstrdup(argv[2]);
- action1 = HDatoi(argv[3]);
- action2 = HDatoi(argv[4]);
+ action1 = atoi(argv[3]);
+ action2 = atoi(argv[4]);
if (!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) {
if (extend_dset_one(fname, dname, action1) < 0)
@@ -422,16 +422,16 @@ main(int argc, char *argv[])
goto error;
}
else {
- HDfprintf(stdout, "Dataset cannot be extended...\n");
+ fprintf(stdout, "Dataset cannot be extended...\n");
goto error;
} /* end if-else */
- HDexit(EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
error:
if (dname)
- HDfree(dname);
+ free(dname);
if (fname)
- HDfree(fname);
- HDexit(EXIT_FAILURE);
+ free(fname);
+ exit(EXIT_FAILURE);
} /* end main() */
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index 248fb90..d5b4d6e 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -121,11 +121,11 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
subset.block.data[i] = block[i];
} /* end for */
- HDmemset(&ctx, 0, sizeof(ctx));
+ memset(&ctx, 0, sizeof(ctx));
ctx.sset = &subset;
/* Set to all default values and then override */
- HDmemset(&info, 0, sizeof info);
+ memset(&info, 0, sizeof info);
if (g_simple_output) {
info.idx_fmt = "";
@@ -199,7 +199,7 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
if ((ret_value = h5tools_dump_dset(stdout, &info, &ctx, did)) < 0)
error_msg("unable to print data\n");
- HDfprintf(stdout, "\n");
+ fprintf(stdout, "\n");
return ret_value;
@@ -292,7 +292,7 @@ monitor_dataset(hid_t fid, char *dsetname)
hsize_t cur_dims[H5S_MAX_RANK]; /* previous dataspace dimensions */
herr_t ret_value = SUCCEED; /* return value */
- HDfprintf(stdout, "Monitoring dataset %s...\n", dsetname);
+ fprintf(stdout, "Monitoring dataset %s...\n", dsetname);
/* Open the dataset for minitoring */
if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
@@ -312,7 +312,7 @@ monitor_dataset(hid_t fid, char *dsetname)
ret_value = FAIL;
goto done;
}
- HDfflush(stdout);
+ fflush(stdout);
/* Loop until an error occurs or the user interrupts execution */
while (!g_user_interrupt) {
@@ -339,14 +339,13 @@ monitor_dataset(hid_t fid, char *dsetname)
if (i != ndims) {
/* Printing changes in dimension sizes */
for (u = 0; u < ndims; u++) {
- HDfprintf(stdout, "dimension %d: %" PRIuHSIZE "->%" PRIuHSIZE "", u, prev_dims[u],
- cur_dims[u]);
+ fprintf(stdout, "dimension %d: %" PRIuHSIZE "->%" PRIuHSIZE "", u, prev_dims[u], cur_dims[u]);
if (cur_dims[u] > prev_dims[u])
- HDfprintf(stdout, " (increases)\n");
+ fprintf(stdout, " (increases)\n");
else if (cur_dims[u] < prev_dims[u])
- HDfprintf(stdout, " (decreases)\n");
+ fprintf(stdout, " (decreases)\n");
else
- HDfprintf(stdout, " (unchanged)\n");
+ fprintf(stdout, " (unchanged)\n");
}
/* Printing elements appended to the dataset if there is */
@@ -360,7 +359,7 @@ monitor_dataset(hid_t fid, char *dsetname)
/* Print the new appended data to the dataset */
if (cur_dims[u] > prev_dims[u]) {
- HDfprintf(stdout, " Data:\n");
+ fprintf(stdout, " Data:\n");
for (j = 0; j < ndims; j++) {
start[j] = 0;
@@ -374,17 +373,17 @@ monitor_dataset(hid_t fid, char *dsetname)
}
} /* end for */
}
- HDfflush(stdout);
+ fflush(stdout);
}
/* Save the current dimension sizes */
- HDmemcpy(prev_dims, cur_dims, (size_t)ndims * sizeof(hsize_t));
+ memcpy(prev_dims, cur_dims, (size_t)ndims * sizeof(hsize_t));
/* Sleep before next monitor */
HDsleep(g_polling_interval);
} /* end while */
- HDfflush(stdout);
+ fflush(stdout);
done:
/* Closing */
@@ -415,7 +414,7 @@ process_cmpd_fields(hid_t fid, char *dsetname)
size_t len; /* number of comma-separated fields in "g_list_of_fields" */
herr_t ret_value = SUCCEED; /* Return value */
- HDassert(g_list_of_fields && *g_list_of_fields);
+ assert(g_list_of_fields && *g_list_of_fields);
/* Open the dataset */
if ((did = H5Dopen2(fid, dsetname, H5P_DEFAULT)) < 0) {
@@ -449,7 +448,7 @@ process_cmpd_fields(hid_t fid, char *dsetname)
len = HDstrlen(g_list_of_fields) / 2 + 2;
/* Allocate memory for a list vector of H5LD_memb_t structures to store "g_list_of_fields" info */
- if ((g_listv = (H5LD_memb_t **)HDcalloc(len, sizeof(H5LD_memb_t *))) == NULL) {
+ if ((g_listv = (H5LD_memb_t **)calloc(len, sizeof(H5LD_memb_t *))) == NULL) {
error_msg("error in allocating memory for H5LD_memb_t\n");
ret_value = FAIL;
goto done;
@@ -532,8 +531,8 @@ check_dataset(hid_t fid, char *dsetname)
goto done;
}
- HDmemset(cur_dims, 0, sizeof cur_dims);
- HDmemset(max_dims, 0, sizeof max_dims);
+ memset(cur_dims, 0, sizeof cur_dims);
+ memset(max_dims, 0, sizeof max_dims);
/* Get dataset's dataspace */
if ((sid = H5Dget_space(did)) < 0) {
@@ -608,46 +607,46 @@ leave(int ret)
static void
usage(const char *prog)
{
- HDfflush(stdout);
- HDfprintf(stdout, "Usage: %s [OPTIONS] [OBJECT]\n", prog);
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " OPTIONS\n");
- HDfprintf(stdout, " --help Print a usage message and exit.\n");
- HDfprintf(stdout, " --version Print version number and exit.\n");
- HDfprintf(stdout, " --label Label members of compound typed dataset.\n");
- HDfprintf(stdout, " --simple Use a machine-readable output format.\n");
- HDfprintf(stdout, " --dim Monitor changes in size of dataset dimensions only.\n");
- HDfprintf(stdout, " --width=N Set the number of columns to N for output.\n");
- HDfprintf(stdout, " A value of 0 sets the number of columns to the\n");
- HDfprintf(stdout, " maximum (65535). The default width is 80 columns.\n");
- HDfprintf(stdout, " --polling=N Set the polling interval to N (in seconds) when the\n");
- HDfprintf(stdout,
- " dataset will be checked for appended data. The default\n");
- HDfprintf(stdout, " polling interval is 1.\n");
- HDfprintf(stdout, " --fields=<list_of_fields>\n");
- HDfprintf(stdout,
- " Display data for the fields specified in <list_of_fields>\n");
- HDfprintf(stdout, " for a compound data type. <list_of_fields> can be\n");
- HDfprintf(stdout, " specified as follows:\n");
- HDfprintf(stdout, " 1) A comma-separated list of field names in a\n");
- HDfprintf(stdout, " compound data type. \",\" is the separator\n");
- HDfprintf(stdout, " for field names while \".\" is the separator\n");
- HDfprintf(stdout, " for a nested field.\n");
- HDfprintf(stdout, " 2) A single field name in a compound data type.\n");
- HDfprintf(stdout, " Can use this option multiple times.\n");
- HDfprintf(stdout, " Note that backslash is the escape character to avoid\n");
- HDfprintf(stdout,
- " characters in field names that conflict with the tool's\n");
- HDfprintf(stdout, " separators.\n");
- HDfprintf(stdout, "\n");
- HDfprintf(stdout, " OBJECT is specified as [<filename>/<path_to_dataset>/<dsetname>]\n");
- HDfprintf(stdout, " <filename> Name of the HDF5 file. It may be preceded by path\n");
- HDfprintf(stdout, " separated by slashes to the specified HDF5 file.\n");
- HDfprintf(stdout, " <path_to_dataset> Path separated by slashes to the specified dataset\n");
- HDfprintf(stdout, " <dsetname> Name of the dataset\n");
- HDfprintf(stdout, "\n");
- HDfprintf(stdout,
- " User can end the h5watch process by ctrl-C (SIGINT) or kill the process (SIGTERM).\n");
+ fflush(stdout);
+ fprintf(stdout, "Usage: %s [OPTIONS] [OBJECT]\n", prog);
+ fprintf(stdout, "\n");
+ fprintf(stdout, " OPTIONS\n");
+ fprintf(stdout, " --help Print a usage message and exit.\n");
+ fprintf(stdout, " --version Print version number and exit.\n");
+ fprintf(stdout, " --label Label members of compound typed dataset.\n");
+ fprintf(stdout, " --simple Use a machine-readable output format.\n");
+ fprintf(stdout, " --dim Monitor changes in size of dataset dimensions only.\n");
+ fprintf(stdout, " --width=N Set the number of columns to N for output.\n");
+ fprintf(stdout, " A value of 0 sets the number of columns to the\n");
+ fprintf(stdout, " maximum (65535). The default width is 80 columns.\n");
+ fprintf(stdout, " --polling=N Set the polling interval to N (in seconds) when the\n");
+ fprintf(stdout,
+ " dataset will be checked for appended data. The default\n");
+ fprintf(stdout, " polling interval is 1.\n");
+ fprintf(stdout, " --fields=<list_of_fields>\n");
+ fprintf(stdout,
+ " Display data for the fields specified in <list_of_fields>\n");
+ fprintf(stdout, " for a compound data type. <list_of_fields> can be\n");
+ fprintf(stdout, " specified as follows:\n");
+ fprintf(stdout, " 1) A comma-separated list of field names in a\n");
+ fprintf(stdout, " compound data type. \",\" is the separator\n");
+ fprintf(stdout, " for field names while \".\" is the separator\n");
+ fprintf(stdout, " for a nested field.\n");
+ fprintf(stdout, " 2) A single field name in a compound data type.\n");
+ fprintf(stdout, " Can use this option multiple times.\n");
+ fprintf(stdout, " Note that backslash is the escape character to avoid\n");
+ fprintf(stdout,
+ " characters in field names that conflict with the tool's\n");
+ fprintf(stdout, " separators.\n");
+ fprintf(stdout, "\n");
+ fprintf(stdout, " OBJECT is specified as [<filename>/<path_to_dataset>/<dsetname>]\n");
+ fprintf(stdout, " <filename> Name of the HDF5 file. It may be preceded by path\n");
+ fprintf(stdout, " separated by slashes to the specified HDF5 file.\n");
+ fprintf(stdout, " <path_to_dataset> Path separated by slashes to the specified dataset\n");
+ fprintf(stdout, " <dsetname> Name of the dataset\n");
+ fprintf(stdout, "\n");
+ fprintf(stdout,
+ " User can end the h5watch process by ctrl-C (SIGINT) or kill the process (SIGTERM).\n");
} /* usage() */
@@ -732,7 +731,7 @@ parse_command_line(int argc, const char *const *argv)
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
leave(EXIT_FAILURE);
}
- if ((g_list_of_fields = (char *)HDrealloc(
+ if ((g_list_of_fields = (char *)realloc(
g_list_of_fields, HDstrlen(g_list_of_fields) + HDstrlen(str) + 2)) == NULL) {
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
leave(EXIT_FAILURE);
@@ -868,7 +867,7 @@ main(int argc, char *argv[])
sizeof drivername);
if (fid >= 0) {
- HDfprintf(stdout, "Opened \"%s\" with %s driver.\n", fname, drivername);
+ fprintf(stdout, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
} /* end if */
@@ -928,17 +927,17 @@ main(int argc, char *argv[])
done:
/* Free spaces */
if (fname)
- HDfree(fname);
+ free(fname);
if (dname)
- HDfree(dname);
+ free(dname);
if (g_list_of_fields)
- HDfree(g_list_of_fields);
+ free(g_list_of_fields);
if (g_listv) {
H5LD_clean_vector(g_listv);
- HDfree(g_listv);
+ free(g_listv);
}
if (g_dup_fields)
- HDfree(g_dup_fields);
+ free(g_dup_fields);
/* Close the file access property list */
if (fapl >= 0 && H5Pclose(fapl) < 0) {
diff --git a/hl/tools/h5watch/h5watchgentest.c b/hl/tools/h5watch/h5watchgentest.c
index 5b8cf07..9fda9be 100644
--- a/hl/tools/h5watch/h5watchgentest.c
+++ b/hl/tools/h5watch/h5watchgentest.c
@@ -172,14 +172,14 @@ main(void)
/* Create a copy of file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- HDexit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
/* Set to use the latest library format */
if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- HDexit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
/* Create a file with the latest format */
if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- HDexit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
/* Initialization for one-dimensional dataset */
cur_dims[0] = ONE_DIMS0;
@@ -341,7 +341,7 @@ main(void)
if (H5Fclose(fid) < 0)
goto done;
- HDexit(EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
done:
H5E_BEGIN_TRY
@@ -356,5 +356,5 @@ done:
H5Fclose(fid);
H5E_END_TRY
- HDexit(EXIT_FAILURE);
+ exit(EXIT_FAILURE);
} /* end main() */