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 /tools/src/misc | |
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 'tools/src/misc')
-rw-r--r-- | tools/src/misc/h5clear.c | 4 | ||||
-rw-r--r-- | tools/src/misc/h5debug.c | 10 | ||||
-rw-r--r-- | tools/src/misc/h5delete.c | 2 | ||||
-rw-r--r-- | tools/src/misc/h5mkgrp.c | 4 | ||||
-rw-r--r-- | tools/src/misc/h5repart.c | 66 |
5 files changed, 43 insertions, 43 deletions
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c index d1ea0c3..31f7c17 100644 --- a/tools/src/misc/h5clear.c +++ b/tools/src/misc/h5clear.c @@ -167,7 +167,7 @@ parse_command_line(int argc, const char *const *argv) goto error; } /* end if */ - fname_g = HDstrdup(argv[H5_optind]); + fname_g = strdup(argv[H5_optind]); done: return (0); @@ -260,7 +260,7 @@ main(int argc, char *argv[]) } /* Duplicate the file name */ - fname = HDstrdup(fname_g); + fname = strdup(fname_g); /* Get a copy of the file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index c93d9c6..1bba419 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -262,7 +262,7 @@ main(int argc, char *argv[]) exit_value = 1; goto done; } /* end if */ - if (HDstrchr(argv[1], '%')) + if (strchr(argv[1], '%')) if (H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT) < 0) { fprintf(stderr, "cannot set file access property list\n"); exit_value = 1; @@ -772,15 +772,15 @@ main(int argc, char *argv[]) printf("%-*s ", VCOL, "Signature:"); for (u = 0; u < sizeof(sig); u++) { if (sig[u] > ' ' && sig[u] <= '~' && '\\' != sig[u]) - HDputchar(sig[u]); + putchar(sig[u]); else if ('\\' == sig[u]) { - HDputchar('\\'); - HDputchar('\\'); + putchar('\\'); + putchar('\\'); } else printf("\\%03o", sig[u]); } - HDputchar('\n'); + putchar('\n'); fprintf(stderr, "unknown signature\n"); exit_value = 4; diff --git a/tools/src/misc/h5delete.c b/tools/src/misc/h5delete.c index c3c8bf0..42a5eaa 100644 --- a/tools/src/misc/h5delete.c +++ b/tools/src/misc/h5delete.c @@ -37,7 +37,7 @@ main(int argc, char *argv[]) switch (argc) { case 3: - if (HDstrcmp(argv[1], "-f") != 0) { + if (strcmp(argv[1], "-f") != 0) { usage(); return EXIT_FAILURE; } diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index baf3b9b..92e3042 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -228,7 +228,7 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options) } /* Retrieve file name */ - options->fname = HDstrdup(argv[H5_optind]); + options->fname = strdup(argv[H5_optind]); H5_optind++; /* Check for group(s) to be created */ @@ -245,7 +245,7 @@ parse_command_line(int argc, const char *const *argv, mkgrp_opt_t *options) /* Retrieve the group names */ curr_group = 0; while (H5_optind < argc) { - options->groups[curr_group] = HDstrdup(argv[H5_optind]); + options->groups[curr_group] = strdup(argv[H5_optind]); curr_group++; H5_optind++; } diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 818a489..feb447f 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -177,7 +177,7 @@ main(int argc, char *argv[]) /* * Get the program name from argv[0]. Use only the last component. */ - if ((prog_name = HDstrrchr(argv[0], '/'))) + if ((prog_name = strrchr(argv[0], '/'))) prog_name++; else prog_name = argv[0]; @@ -186,20 +186,20 @@ main(int argc, char *argv[]) * Parse switches. */ while (argno < argc && '-' == argv[argno][0]) { - if (!HDstrcmp(argv[argno], "-v")) { + if (!strcmp(argv[argno], "-v")) { verbose = true; argno++; } - else if (!HDstrcmp(argv[argno], "-V")) { + else if (!strcmp(argv[argno], "-V")) { printf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); exit(EXIT_SUCCESS); } - else if (!HDstrcmp(argv[argno], "-family_to_sec2")) { + else if (!strcmp(argv[argno], "-family_to_sec2")) { family_to_single = true; argno++; } - else if (!HDstrcmp(argv[argno], "-family_to_single")) { + else if (!strcmp(argv[argno], "-family_to_single")) { family_to_single = true; argno++; } @@ -227,16 +227,16 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); src_gen_name = argv[argno++]; - HDsnprintf(src_name, NAMELEN, src_gen_name, src_membno); + snprintf(src_name, NAMELEN, src_gen_name, src_membno); src_is_family = strcmp(src_name, src_gen_name); if ((src = HDopen(src_name, O_RDONLY)) < 0) { - HDperror(src_name); + perror(src_name); exit(EXIT_FAILURE); } if (HDfstat(src, &sb) < 0) { - HDperror("fstat"); + perror("fstat"); exit(EXIT_FAILURE); } src_size = src_act_size = sb.st_size; @@ -249,11 +249,11 @@ main(int argc, char *argv[]) if (argno >= argc) usage(prog_name); dst_gen_name = argv[argno++]; - HDsnprintf(dst_name, NAMELEN, dst_gen_name, dst_membno); - dst_is_family = HDstrcmp(dst_name, dst_gen_name); + snprintf(dst_name, NAMELEN, dst_gen_name, dst_membno); + dst_is_family = strcmp(dst_name, dst_gen_name); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { - HDperror(dst_name); + perror(dst_name); exit(EXIT_FAILURE); } if (verbose) @@ -283,7 +283,7 @@ main(int argc, char *argv[]) else if (src_offset < src_act_size) { n = (size_t)MIN((off_t)n, src_act_size - src_offset); if ((nio = HDread(src, buf, n)) < 0) { - HDperror("read"); + perror("read"); exit(EXIT_FAILURE); } else if ((size_t)nio != n) { @@ -309,11 +309,11 @@ main(int argc, char *argv[]) */ if (need_write) { if (need_seek && HDlseek(dst, dst_offset, SEEK_SET) < 0) { - HDperror("HDlseek"); + perror("HDlseek"); exit(EXIT_FAILURE); } if ((nio = HDwrite(dst, buf, n)) < 0) { - HDperror("write"); + perror("write"); exit(EXIT_FAILURE); } else if ((size_t)nio != n) { @@ -341,17 +341,17 @@ main(int argc, char *argv[]) dst_offset = dst_offset + (off_t)n; break; } - HDsnprintf(src_name, NAMELEN, src_gen_name, ++src_membno); + snprintf(src_name, NAMELEN, src_gen_name, ++src_membno); if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) { dst_offset = dst_offset + (off_t)n; break; } else if (src < 0) { - HDperror(src_name); + perror(src_name); exit(EXIT_FAILURE); } if (HDfstat(src, &sb) < 0) { - HDperror("fstat"); + perror("fstat"); exit(EXIT_FAILURE); } src_act_size = sb.st_size; @@ -372,26 +372,26 @@ main(int argc, char *argv[]) if (dst_is_family && dst_offset == dst_size) { if (0 == dst_membno) { if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) { - HDperror("HDHDlseek"); + perror("HDHDlseek"); exit(EXIT_FAILURE); } if (HDread(dst, buf, 1) < 0) { - HDperror("read"); + perror("read"); exit(EXIT_FAILURE); } if (HDlseek(dst, dst_size - 1, SEEK_SET) < 0) { - HDperror("HDlseek"); + perror("HDlseek"); exit(EXIT_FAILURE); } if (HDwrite(dst, buf, 1) < 0) { - HDperror("write"); + perror("write"); exit(EXIT_FAILURE); } } HDclose(dst); - HDsnprintf(dst_name, NAMELEN, dst_gen_name, ++dst_membno); + snprintf(dst_name, NAMELEN, dst_gen_name, ++dst_membno); if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { - HDperror(dst_name); + perror(dst_name); exit(EXIT_FAILURE); } dst_offset = 0; @@ -408,19 +408,19 @@ main(int argc, char *argv[]) */ if (need_seek) { if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) { - HDperror("HDlseek"); + perror("HDlseek"); exit(EXIT_FAILURE); } if (HDread(dst, buf, 1) < 0) { - HDperror("read"); + perror("read"); exit(EXIT_FAILURE); } if (HDlseek(dst, dst_offset - 1, SEEK_SET) < 0) { - HDperror("HDlseek"); + perror("HDlseek"); exit(EXIT_FAILURE); } if (HDwrite(dst, buf, 1) < 0) { - HDperror("write"); + perror("write"); exit(EXIT_FAILURE); } } @@ -429,7 +429,7 @@ main(int argc, char *argv[]) /* Modify family driver information saved in superblock through private property. * These private properties are for this tool only. */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - HDperror("H5Pcreate"); + perror("H5Pcreate"); exit(EXIT_FAILURE); } @@ -439,7 +439,7 @@ main(int argc, char *argv[]) * the library to ignore the family driver information saved in the superblock. */ if (H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) { - HDperror("H5Pset"); + perror("H5Pset"); exit(EXIT_FAILURE); } } @@ -448,14 +448,14 @@ main(int argc, char *argv[]) * library to save the new member size(specified in command line) in superblock. * This private property is for this tool only. */ if (H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { - HDperror("H5Pset_fapl_family"); + perror("H5Pset_fapl_family"); exit(EXIT_FAILURE); } /* Set the property of the new member size as hsize_t */ hdsize = (hsize_t)dst_size; if (H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { - HDperror("H5Pset"); + perror("H5Pset"); exit(EXIT_FAILURE); } } @@ -476,13 +476,13 @@ main(int argc, char *argv[]) if (file >= 0) { if (H5Fclose(file) < 0) { - HDperror("H5Fclose"); + perror("H5Fclose"); exit(EXIT_FAILURE); } /* end if */ } /* end if */ if (H5Pclose(fapl) < 0) { - HDperror("H5Pclose"); + perror("H5Pclose"); exit(EXIT_FAILURE); } /* end if */ |