diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-09-15 22:13:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 22:13:18 (GMT) |
commit | 44a00ef876ad3e1922847e93feac57c479217fbe (patch) | |
tree | 5e9fc677913a06a71eba1342633f92e93bd07a6c /test/titerate.c | |
parent | 59a90368cdb696205bdf15040d1a48b4f69af97f (diff) | |
download | hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.zip hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.gz hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.bz2 |
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
Diffstat (limited to 'test/titerate.c')
-rw-r--r-- | test/titerate.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/test/titerate.c b/test/titerate.c index 43f3ddc..57b4d06 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -74,7 +74,7 @@ herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo, v H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2) { - return (HDstrcmp(*(const char *const *)s1, *(const char *const *)s2)); + return (strcmp(*(const char *const *)s1, *(const char *const *)s2)); } /**************************************************************** @@ -90,7 +90,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR static int count = 0; static int count2 = 0; - HDstrcpy(info->name, name); + strcpy(info->name, name); switch (info->command) { case RET_ZERO: @@ -155,12 +155,12 @@ test_iter_group(hid_t fapl, bool new_format) CHECK(filespace, FAIL, "H5Screate"); for (i = 0; i < NDATASETS; i++) { - HDsnprintf(name, sizeof(name), "Dataset %d", i); + snprintf(name, sizeof(name), "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Keep a copy of the dataset names around for later */ - lnames[i] = HDstrdup(name); + lnames[i] = strdup(name); CHECK_PTR(lnames[i], "strdup"); ret = H5Dclose(dataset); @@ -171,13 +171,13 @@ test_iter_group(hid_t fapl, bool new_format) grp = H5Gcreate2(file, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Gcreate2"); - lnames[NDATASETS] = HDstrdup("grp"); + lnames[NDATASETS] = strdup("grp"); CHECK_PTR(lnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); - lnames[NDATASETS + 1] = HDstrdup("dtype"); + lnames[NDATASETS + 1] = strdup("dtype"); CHECK_PTR(lnames[NDATASETS], "strdup"); /* Close everything up */ @@ -319,7 +319,7 @@ test_iter_group(hid_t fapl, bool new_format) TestErrPrintf("Group iteration function walked too far!\n"); /* Verify that the correct name is retrieved */ - if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) + if (strcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf( "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); @@ -348,7 +348,7 @@ test_iter_group(hid_t fapl, bool new_format) TestErrPrintf("Group iteration function walked too far!\n"); /* Verify that the correct name is retrieved */ - if (HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) + if (strcmp(info.name, lnames[(size_t)(idx - 1)]) != 0) TestErrPrintf( "Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]); @@ -379,7 +379,7 @@ aiter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5A_info_t H5_ATTR_ static int count = 0; static int count2 = 0; - HDstrcpy(info->name, name); + strcpy(info->name, name); switch (info->command) { case RET_ZERO: @@ -435,12 +435,12 @@ test_iter_attr(hid_t fapl, bool new_format) CHECK(dataset, FAIL, "H5Dcreate2"); for (i = 0; i < NATTR; i++) { - HDsnprintf(name, sizeof(name), "Attribute %02d", i); + snprintf(name, sizeof(name), "Attribute %02d", i); attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT); CHECK(attribute, FAIL, "H5Acreate2"); /* Keep a copy of the attribute names around for later */ - anames[i] = HDstrdup(name); + anames[i] = strdup(name); CHECK_PTR(anames[i], "strdup"); ret = H5Aclose(attribute); @@ -509,7 +509,7 @@ test_iter_attr(hid_t fapl, bool new_format) /* Don't check name when new format is used */ if (!new_format) { /* Verify that the correct name is retrieved */ - if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0) + if (strcmp(info.name, anames[(size_t)idx - 1]) != 0) TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = " "'%s', anames[%u] = '%s'!\n", __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]); @@ -538,7 +538,7 @@ test_iter_attr(hid_t fapl, bool new_format) /* Don't check name when new format is used */ if (!new_format) { /* Verify that the correct name is retrieved */ - if (HDstrcmp(info.name, anames[(size_t)idx - 1]) != 0) + if (strcmp(info.name, anames[(size_t)idx - 1]) != 0) TestErrPrintf("%u: Attribute iteration function didn't set names correctly, info.name = " "'%s', anames[%u] = '%s'!\n", __LINE__, info.name, (unsigned)(idx - 1), anames[(size_t)idx - 1]); @@ -569,7 +569,7 @@ test_iter_attr(hid_t fapl, bool new_format) H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2) { - return (HDstrcmp((const char *)s1, (const char *)s2)); + return (strcmp((const char *)s1, (const char *)s2)); } /* end iter_strcmp2() */ /**************************************************************** @@ -584,7 +584,7 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link H5O_info2_t oinfo; herr_t ret; /* Generic return value */ - if (HDstrcmp(name, test_info->name) != 0) { + if (strcmp(name, test_info->name) != 0) { TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name); return (H5_ITER_ERROR); } /* end if */ @@ -648,10 +648,10 @@ test_iter_group_large(hid_t fapl) /* Create a bunch of groups */ for (i = 0; i < ITER_NGROUPS; i++) { - HDsnprintf(gname, sizeof(gname), "Group_%d", i); + snprintf(gname, sizeof(gname), "Group_%d", i); /* Add the name to the list of objects in the root group */ - HDstrcpy(names[i].name, gname); + strcpy(names[i].name, gname); names[i].type = H5O_TYPE_GROUP; /* Create a group */ @@ -668,7 +668,7 @@ test_iter_group_large(hid_t fapl) CHECK(dataset, FAIL, "H5Dcreate2"); /* Add the name to the list of objects in the root group */ - HDstrcpy(names[ITER_NGROUPS].name, "Dataset1"); + strcpy(names[ITER_NGROUPS].name, "Dataset1"); names[ITER_NGROUPS].type = H5O_TYPE_DATASET; /* Close Dataset */ @@ -698,7 +698,7 @@ test_iter_group_large(hid_t fapl) CHECK(ret, FAIL, "H5Tcommit2"); /* Add the name to the list of objects in the root group */ - HDstrcpy(names[ITER_NGROUPS + 1].name, "Datatype1"); + strcpy(names[ITER_NGROUPS + 1].name, "Datatype1"); names[ITER_NGROUPS + 1].type = H5O_TYPE_NAMED_DATATYPE; /* Close datatype */ @@ -765,12 +765,12 @@ test_grp_memb_funcs(hid_t fapl) CHECK(filespace, FAIL, "H5Screate"); for (i = 0; i < NDATASETS; i++) { - HDsnprintf(name, sizeof(name), "Dataset %d", i); + snprintf(name, sizeof(name), "Dataset %d", i); dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dataset, FAIL, "H5Dcreate2"); /* Keep a copy of the dataset names around for later */ - dnames[i] = HDstrdup(name); + dnames[i] = strdup(name); CHECK_PTR(dnames[i], "strdup"); ret = H5Dclose(dataset); @@ -781,13 +781,13 @@ test_grp_memb_funcs(hid_t fapl) grp = H5Gcreate2(file, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Gcreate2"); - dnames[NDATASETS] = HDstrdup("grp"); + dnames[NDATASETS] = strdup("grp"); CHECK_PTR(dnames[NDATASETS], "strdup"); ret = H5Tcommit2(file, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Tcommit2"); - dnames[NDATASETS + 1] = HDstrdup("dtype"); + dnames[NDATASETS + 1] = strdup("dtype"); CHECK_PTR(dnames[NDATASETS], "strdup"); /* Close everything up */ @@ -836,18 +836,18 @@ test_grp_memb_funcs(hid_t fapl) VERIFY(ret, name_len, "H5Lget_name_by_idx"); /* Keep a copy of the dataset names around for later */ - obj_names[i] = HDstrdup(dataset_name); + obj_names[i] = strdup(dataset_name); CHECK_PTR(obj_names[i], "strdup"); ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); CHECK(ret, FAIL, "H5Oget_info_by_idx3"); - if (!HDstrcmp(dataset_name, "grp")) + if (!strcmp(dataset_name, "grp")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); - if (!HDstrcmp(dataset_name, "dtype")) + if (!strcmp(dataset_name, "dtype")) VERIFY(oinfo.type, H5O_TYPE_NAMED_DATATYPE, "H5Lget_name_by_idx"); - if (!HDstrncmp(dataset_name, "Dataset", (size_t)7)) + if (!strncmp(dataset_name, "Dataset", (size_t)7)) VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Lget_name_by_idx"); } /* end for */ @@ -865,8 +865,8 @@ test_grp_memb_funcs(hid_t fapl) /* Compare object names */ for (i = 0; i < (int)ginfo.nlinks; i++) { - ret = HDstrcmp(dnames[i], obj_names[i]); - VERIFY(ret, 0, "HDstrcmp"); + ret = strcmp(dnames[i], obj_names[i]); + VERIFY(ret, 0, "strcmp"); } /* end for */ ret = H5Gclose(root_group); @@ -944,11 +944,11 @@ test_links(hid_t fapl) CHECK(ret, FAIL, "H5Oget_info_by_idx3"); } /* end if */ - if (!HDstrcmp(obj_name, "g1.1")) + if (!strcmp(obj_name, "g1.1")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); - else if (!HDstrcmp(obj_name, "hardlink")) + else if (!strcmp(obj_name, "hardlink")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); - else if (!HDstrcmp(obj_name, "softlink")) + else if (!strcmp(obj_name, "softlink")) VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); else ERROR("unknown object name"); @@ -985,7 +985,7 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_ return H5_ITER_ERROR; /* If the searched error message is found, stop the iteration */ - if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, searched_err->message) == 0) { + if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) { searched_err->found = true; status = H5_ITER_STOP; } @@ -1043,7 +1043,7 @@ test_corrupted_attnamelen(void) /* Make sure the intended error was caught */ if (err_status == -1) { /* Initialize client data */ - HDstrcpy(err_caught.message, err_message); + strcpy(err_caught.message, err_message); err_caught.found = false; /* Look for the correct error message */ @@ -1126,11 +1126,11 @@ test_links_deprec(hid_t fapl) CHECK(ret, FAIL, "H5Oget_info_by_idx"); } /* end if */ - if (!HDstrcmp(obj_name, "g1.1")) + if (!strcmp(obj_name, "g1.1")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); - else if (!HDstrcmp(obj_name, "hardlink")) + else if (!strcmp(obj_name, "hardlink")) VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx"); - else if (!HDstrcmp(obj_name, "softlink")) + else if (!strcmp(obj_name, "softlink")) VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx"); else ERROR("unknown object name"); |