Strip HD prefix from string/char C API calls (#3540)

* Strip HD prefix from string/char C API calls

* HD(f)(put|get)(s|c)
* HDstr*
* HDv*printf
* HD(s)(print|scan)f
* HDperror

But NOT:

* HDstrcase*
* HDvasprintf
* HDstrtok_r
* HDstrndup

As those are not C99 and have portability work-around
implementations. They will be handled later.

* Fix th5_system.c screwup
This commit is contained in:
Dana Robinson
2023-09-15 15:13:18 -07:00
committed by GitHub
parent 59a90368cd
commit 44a00ef876
363 changed files with 6157 additions and 6346 deletions
+6 -6
View File
@@ -239,8 +239,8 @@ main(int argc, char **argv)
if (NULL == (test_path_prefix = HDgetenv(HDF5_API_TEST_PATH_PREFIX)))
test_path_prefix = "";
HDsnprintf(H5_api_test_parallel_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
PARALLEL_TEST_FILE_NAME);
snprintf(H5_api_test_parallel_filename, H5_API_TEST_FILENAME_MAX_LENGTH, "%s%s", test_path_prefix,
PARALLEL_TEST_FILE_NAME);
if (NULL == (vol_connector_string = HDgetenv(HDF5_VOL_CONNECTOR))) {
if (MAINPROCESS)
@@ -253,7 +253,7 @@ main(int argc, char **argv)
BEGIN_INDEPENDENT_OP(copy_connector_string)
{
if (NULL == (vol_connector_string_copy = HDstrdup(vol_connector_string))) {
if (NULL == (vol_connector_string_copy = strdup(vol_connector_string))) {
if (MAINPROCESS)
fprintf(stderr, "Unable to copy VOL connector string\n");
INDEPENDENT_OP_ERROR(copy_connector_string);
@@ -263,7 +263,7 @@ main(int argc, char **argv)
BEGIN_INDEPENDENT_OP(get_connector_name)
{
if (NULL == (token = HDstrtok(vol_connector_string_copy, " "))) {
if (NULL == (token = strtok(vol_connector_string_copy, " "))) {
if (MAINPROCESS)
fprintf(stderr, "Error while parsing VOL connector string\n");
INDEPENDENT_OP_ERROR(get_connector_name);
@@ -273,7 +273,7 @@ main(int argc, char **argv)
vol_connector_name = token;
if (NULL != (token = HDstrtok(NULL, " "))) {
if (NULL != (token = strtok(NULL, " "))) {
vol_connector_info = token;
}
}
@@ -307,7 +307,7 @@ main(int argc, char **argv)
* Otherwise, HDF5 will default to running the tests
* with the native connector, which could be misleading.
*/
if (0 != HDstrcmp(vol_connector_name, "native")) {
if (0 != strcmp(vol_connector_name, "native")) {
htri_t is_registered;
if ((is_registered = H5VLis_connector_registered_by_name(vol_connector_name)) < 0) {
+1 -1
View File
@@ -139,7 +139,7 @@ extern char H5_api_test_parallel_filename[];
{ \
if (MAINPROCESS) { \
printf("Testing %-62s", WHAT); \
HDputs(""); \
puts(""); \
fflush(stdout); \
} \
}
+7 -7
View File
@@ -3401,10 +3401,10 @@ test_actual_io_mode(int selection_mode)
/* Test values */
if (actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t)-1 &&
actual_io_mode_expected != (H5D_mpio_actual_io_mode_t)-1) {
HDsnprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n",
test_name);
snprintf(message, sizeof(message), "Actual Chunk Opt Mode has the correct value for %s.\n",
test_name);
VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message);
HDsnprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name);
snprintf(message, sizeof(message), "Actual IO Mode has the correct value for %s.\n", test_name);
VRFY((actual_io_mode_write == actual_io_mode_expected), message);
}
else {
@@ -3822,12 +3822,12 @@ test_no_collective_cause_mode(int selection_mode)
/* Test values */
memset(message, 0, sizeof(message));
HDsnprintf(message, sizeof(message),
"Local cause of Broken Collective I/O has the correct value for %s.\n", test_name);
snprintf(message, sizeof(message), "Local cause of Broken Collective I/O has the correct value for %s.\n",
test_name);
VRFY((no_collective_cause_local_write == no_collective_cause_local_expected), message);
memset(message, 0, sizeof(message));
HDsnprintf(message, sizeof(message),
"Global cause of Broken Collective I/O has the correct value for %s.\n", test_name);
snprintf(message, sizeof(message),
"Global cause of Broken Collective I/O has the correct value for %s.\n", test_name);
VRFY((no_collective_cause_global_write == no_collective_cause_global_expected), message);
/* Release some resources */
+8 -8
View File
@@ -529,25 +529,25 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str
VRFY((mem_dataspace >= 0), "");
for (k = 0; k < NUM_DSETS; k++) {
HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D1dset%d", k);
dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "");
ret = H5Dclose(dset_id);
VRFY((ret == 0), "");
HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D2dset%d", k);
dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "");
ret = H5Dclose(dset_id);
VRFY((ret == 0), "");
HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D3dset%d", k);
dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "");
ret = H5Dclose(dset_id);
VRFY((ret == 0), "");
HDsnprintf(dset_name, sizeof(dset_name), "dset%d", k);
snprintf(dset_name, sizeof(dset_name), "dset%d", k);
dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dset_id >= 0), "");
@@ -570,13 +570,13 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str
for (i = 0; i < num_elements; i++)
VRFY((data_array[i] == mpi_rank + 1), "Dataset Verify failed");
HDsnprintf(dset_name, sizeof(dset_name), "D1dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D1dset%d", k);
ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT);
VRFY((ret == 0), "");
HDsnprintf(dset_name, sizeof(dset_name), "D2dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D2dset%d", k);
ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT);
VRFY((ret == 0), "");
HDsnprintf(dset_name, sizeof(dset_name), "D3dset%d", k);
snprintf(dset_name, sizeof(dset_name), "D3dset%d", k);
ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT);
VRFY((ret == 0), "");
}
@@ -682,7 +682,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t
VRFY((mem_dataspace >= 0), "");
for (k = 0; k < NUM_DSETS; k++) {
HDsnprintf(dset_name, sizeof(dset_name), "dset%d", k);
snprintf(dset_name, sizeof(dset_name), "dset%d", k);
dset_id = H5Dopen2(grp_id, dset_name, H5P_DEFAULT);
VRFY((dset_id >= 0), "");
+1 -1
View File
@@ -100,7 +100,7 @@ file_image_daisy_chain_test(void)
}
/* setup file name */
HDsnprintf(file_name, 1024, "file_image_daisy_chain_test_%05d.h5", (int)mpi_rank);
snprintf(file_name, 1024, "file_image_daisy_chain_test_%05d.h5", (int)mpi_rank);
if (mpi_rank == 0) {
+15 -15
View File
@@ -211,7 +211,7 @@ multiple_dset_write(void)
VRFY((ret >= 0), "set fill-value succeeded");
for (n = 0; n < ndatasets; n++) {
HDsnprintf(dname, sizeof(dname), "dataset %d", n);
snprintf(dname, sizeof(dname), "dataset %d", n);
dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((dataset > 0), dname);
@@ -975,11 +975,11 @@ collective_group_write(void)
/* creates ngroups groups under the root group, writes chunked
* datasets in parallel. */
for (m = 0; m < ngroups; m++) {
HDsnprintf(gname, sizeof(gname), "group%d", m);
snprintf(gname, sizeof(gname), "group%d", m);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((gid > 0), gname);
HDsnprintf(dname, sizeof(dname), "dataset%d", m);
snprintf(dname, sizeof(dname), "dataset%d", m);
did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
VRFY((did > 0), dname);
@@ -1093,12 +1093,12 @@ group_dataset_read(hid_t fid, int mpi_rank, int m)
VRFY((outdata != NULL), "malloc succeeded for outdata");
/* open every group under root group. */
HDsnprintf(gname, sizeof(gname), "group%d", m);
snprintf(gname, sizeof(gname), "group%d", m);
gid = H5Gopen2(fid, gname, H5P_DEFAULT);
VRFY((gid > 0), gname);
/* check the data. */
HDsnprintf(dname, sizeof(dname), "dataset%d", m);
snprintf(dname, sizeof(dname), "dataset%d", m);
did = H5Dopen2(gid, dname, H5P_DEFAULT);
VRFY((did > 0), dname);
@@ -1211,7 +1211,7 @@ multiple_group_write(void)
/* creates ngroups groups under the root group, writes datasets in
* parallel. */
for (m = 0; m < ngroups; m++) {
HDsnprintf(gname, sizeof(gname), "group%d", m);
snprintf(gname, sizeof(gname), "group%d", m);
gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((gid > 0), gname);
@@ -1267,7 +1267,7 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid)
VRFY((outme != NULL), "malloc succeeded for outme");
for (n = 0; n < NDATASET; n++) {
HDsnprintf(dname, sizeof(dname), "dataset%d", n);
snprintf(dname, sizeof(dname), "dataset%d", n);
did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((did > 0), dname);
@@ -1305,7 +1305,7 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter)
}
#endif /* BARRIER_CHECKS */
HDsnprintf(gname, sizeof(gname), "%dth_child_group", counter + 1);
snprintf(gname, sizeof(gname), "%dth_child_group", counter + 1);
child_gid = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((child_gid > 0), gname);
@@ -1376,7 +1376,7 @@ multiple_group_read(void)
/* open every group under root group. */
for (m = 0; m < ngroups; m++) {
HDsnprintf(gname, sizeof(gname), "group%d", m);
snprintf(gname, sizeof(gname), "group%d", m);
gid = H5Gopen2(fid, gname, H5P_DEFAULT);
VRFY((gid > 0), gname);
@@ -1433,7 +1433,7 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid)
VRFY((outdata != NULL), "malloc succeeded for outdata");
for (n = 0; n < NDATASET; n++) {
HDsnprintf(dname, sizeof(dname), "dataset%d", n);
snprintf(dname, sizeof(dname), "dataset%d", n);
did = H5Dopen2(gid, dname, H5P_DEFAULT);
VRFY((did > 0), dname);
@@ -1484,7 +1484,7 @@ recursive_read_group(hid_t memspace, hid_t filespace, hid_t gid, int counter)
nerrors += err_num;
if (counter < GROUP_DEPTH) {
HDsnprintf(gname, sizeof(gname), "%dth_child_group", counter + 1);
snprintf(gname, sizeof(gname), "%dth_child_group", counter + 1);
child_gid = H5Gopen2(gid, gname, H5P_DEFAULT);
VRFY((child_gid > 0), gname);
recursive_read_group(memspace, filespace, child_gid, counter + 1);
@@ -1506,7 +1506,7 @@ write_attribute(hid_t obj_id, int this_type, int num)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
if (this_type == is_group) {
HDsnprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num);
snprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num);
sid = H5Screate(H5S_SCALAR);
aid = H5Acreate2(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
H5Awrite(aid, H5T_NATIVE_INT, &num);
@@ -1514,7 +1514,7 @@ write_attribute(hid_t obj_id, int this_type, int num)
H5Sclose(sid);
} /* end if */
else if (this_type == is_dset) {
HDsnprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num);
snprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num);
for (i = 0; i < 8; i++)
attr_data[i] = i;
sid = H5Screate_simple(dspace_rank, dspace_dims, NULL);
@@ -1537,14 +1537,14 @@ read_attribute(hid_t obj_id, int this_type, int num)
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
if (this_type == is_group) {
HDsnprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num);
snprintf(attr_name, sizeof(attr_name), "Group Attribute %d", num);
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
H5Aread(aid, H5T_NATIVE_INT, &in_num);
vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num);
H5Aclose(aid);
}
else if (this_type == is_dset) {
HDsnprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num);
snprintf(attr_name, sizeof(attr_name), "Dataset Attribute %d", num);
for (i = 0; i < 8; i++)
out_data[i] = i;
aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT);
+1 -1
View File
@@ -569,7 +569,7 @@ external_links(void)
/* test opening a group that is to an external link, the external linked
file should inherit the source file's access properties */
HDsnprintf(link_path, sizeof(link_path), "%s%s%s", group_path, "/", link_name);
snprintf(link_path, sizeof(link_path), "%s%s%s", group_path, "/", link_name);
group = H5Gopen2(fid, link_path, H5P_DEFAULT);
VRFY((group >= 0), "H5Gopen succeeded");
ret = H5Gclose(group);