From 4dbaec7991f5233ea38ff23c20b925af441e47f8 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 8 Apr 2024 07:58:13 -0700 Subject: [PATCH] Remove HD from last non-win32 C89 functions (#4348) Removes the HD prefix from the last C89 functions with no special Windows equilvalent: * rename * rewind * setbuf * signal * tmpfile --- hl/tools/h5watch/h5watch.c | 4 ++-- src/H5Clog_json.c | 2 +- src/H5Clog_trace.c | 2 +- src/H5private.h | 15 --------------- test/app_ref.c | 2 +- test/del_many_dense_attrs.c | 2 +- test/dt_arith.c | 2 +- test/filenotclosed.c | 2 +- test/h5test.c | 8 ++++---- test/tcheck_version.c | 4 ++-- testpar/t_2Gio.c | 4 ++-- testpar/t_shapesame.c | 4 ++-- testpar/testphdf5.c | 4 ++-- tools/lib/h5tools_utils.c | 2 +- 14 files changed, 21 insertions(+), 36 deletions(-) diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index 2e6071c007b..b4dd62fd70c 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -785,13 +785,13 @@ main(int argc, char *argv[]) h5tools_init(); /* To exit from h5watch for SIGTERM signal */ - if (HDsignal(SIGTERM, catch_signal) == SIG_ERR) { + if (signal(SIGTERM, catch_signal) == SIG_ERR) { error_msg("An error occurred while setting a signal handler.\n"); leave(EXIT_FAILURE); } /* To exit from h5watch for SIGINT signal */ - if (HDsignal(SIGINT, catch_signal) == SIG_ERR) { + if (signal(SIGINT, catch_signal) == SIG_ERR) { error_msg("An error occurred while setting a signal handler.\n"); leave(EXIT_FAILURE); } diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index 371d48752c9..e273f55d2ba 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -245,7 +245,7 @@ H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mp /* Open log file and set it to be unbuffered */ if (NULL == (json_udata->outfile = fopen(file_name, "w"))) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file"); - HDsetbuf(json_udata->outfile, NULL); + setbuf(json_udata->outfile, NULL); done: if (file_name) diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 6b31d988f8e..4b845d56e88 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -240,7 +240,7 @@ H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int m /* Open log file and set it to be unbuffered */ if (NULL == (trace_udata->outfile = fopen(file_name, "w"))) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file"); - HDsetbuf(trace_udata->outfile, NULL); + setbuf(trace_udata->outfile, NULL); /* Write the header */ fprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n"); diff --git a/src/H5private.h b/src/H5private.h index 17a30d9c3f1..cdeacc866a1 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -790,18 +790,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDremove #define HDremove(S) remove(S) #endif -#ifndef HDrename -#define HDrename(OLD, NEW) rename(OLD, NEW) -#endif -#ifndef HDrewind -#define HDrewind(F) rewind(F) -#endif #ifndef HDrmdir #define HDrmdir(S) rmdir(S) #endif -#ifndef HDsetbuf -#define HDsetbuf(F, S) setbuf(F, S) -#endif #ifndef HDsetenv #define HDsetenv(N, V, O) setenv(N, V, O) #endif @@ -817,9 +808,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDsigemptyset #define HDsigemptyset(S) sigemptyset(S) #endif -#ifndef HDsignal -#define HDsignal(N, F) signal(N, F) -#endif #ifndef HDsleep #define HDsleep(N) sleep(N) #endif @@ -842,9 +830,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) #endif -#ifndef HDtmpfile -#define HDtmpfile() tmpfile() -#endif #ifndef HDunlink #define HDunlink(S) unlink(S) #endif diff --git a/test/app_ref.c b/test/app_ref.c index 2f093981d9c..a62dc19fea2 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -172,7 +172,7 @@ main(void) RAND_INC(T_ESTACK); - HDsignal(SIGABRT, &Abrt_Handler); + signal(SIGABRT, &Abrt_Handler); if (H5close() < 0) TEST_ERROR; diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c index b0000f9518d..0037c3c4270 100644 --- a/test/del_many_dense_attrs.c +++ b/test/del_many_dense_attrs.c @@ -69,7 +69,7 @@ main(void) h5_reset(); /* To exit from the file for SIGABRT signal */ - if (HDsignal(SIGABRT, catch_signal) == SIG_ERR) + if (signal(SIGABRT, catch_signal) == SIG_ERR) TEST_ERROR; fapl = h5_fileaccess(); diff --git a/test/dt_arith.c b/test/dt_arith.c index 34afdb92132..9ef47fc7b63 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -3261,7 +3261,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) * The remainder of this function is executed only by the child if * HANDLE_SIGFPE is defined. */ - HDsignal(SIGFPE, fpe_handler); + signal(SIGFPE, fpe_handler); /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_FLOAT)) { diff --git a/test/filenotclosed.c b/test/filenotclosed.c index a42e1a8c43e..66b0052b52b 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -80,7 +80,7 @@ main(void) h5_reset(); /* To exit from the file for SIGABRT signal */ - if (HDsignal(SIGABRT, catch_signal) == SIG_ERR) + if (signal(SIGABRT, catch_signal) == SIG_ERR) TEST_ERROR; fapl = h5_fileaccess(); diff --git a/test/h5test.c b/test/h5test.c index a472dc9d5c5..b8888dfec5b 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1784,7 +1784,7 @@ h5_send_message(const char *send, const char *arg1, const char *arg2) fclose(signalfile); - HDrename(TMP_SIGNAL_FILE, send); + rename(TMP_SIGNAL_FILE, send); } /* h5_send_message() */ /*------------------------------------------------------------------------- @@ -2099,8 +2099,8 @@ h5_compare_file_bytes(char *f1name, char *f2name) } /* Compare each byte and fail if a difference is found */ - HDrewind(f1ptr); - HDrewind(f2ptr); + rewind(f1ptr); + rewind(f2ptr); for (ii = 0; ii < f1size; ii++) { if (fread(&f1char, 1, 1, f1ptr) != 1) { ret_value = -1; @@ -2216,7 +2216,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) HDfseek(orig_ptr, 0, SEEK_END); fsize = (size_t)HDftell(orig_ptr); - HDrewind(orig_ptr); + rewind(orig_ptr); dest_ptr = fopen(dest, "wb"); if (NULL == dest_ptr) { diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 53ca8613090..5d17e6baef5 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -126,9 +126,9 @@ main(int ac, char **av) (void)_CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, handle_crt_abort); #endif parse(ac, av); - HDsignal(SIGABRT, &abort_intercept); + signal(SIGABRT, &abort_intercept); H5check_version(major, minor, release); - HDsignal(SIGABRT, SIG_DFL); + signal(SIGABRT, SIG_DFL); #ifdef H5_HAVE_WIN32_API (void)_CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, handle_crt_abort); #endif diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index b6c3988604d..8674e35369e 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -4270,8 +4270,8 @@ main(int argc, char **argv) #ifndef H5_HAVE_WIN32_API /* Un-buffer the stdout and stderr */ - HDsetbuf(stderr, NULL); - HDsetbuf(stdout, NULL); + setbuf(stderr, NULL); + setbuf(stdout, NULL); #endif MPI_Init(&argc, &argv); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index e6bb35b921b..ecb94c3729c 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4283,8 +4283,8 @@ main(int argc, char **argv) #ifndef H5_HAVE_WIN32_API /* Un-buffer the stdout and stderr */ - HDsetbuf(stderr, NULL); - HDsetbuf(stdout, NULL); + setbuf(stderr, NULL); + setbuf(stdout, NULL); #endif #ifdef H5_HAVE_TEST_API diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 54e537f422c..7de274fc230 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -317,8 +317,8 @@ main(int argc, char **argv) #ifndef H5_HAVE_WIN32_API /* Un-buffer the stdout and stderr */ - HDsetbuf(stderr, NULL); - HDsetbuf(stdout, NULL); + setbuf(stderr, NULL); + setbuf(stdout, NULL); #endif #ifdef H5_HAVE_TEST_API diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index d7e7ff574a9..d764de2d8f3 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -79,7 +79,7 @@ parallel_print(const char *format, ...) /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; - overflow_file = HDtmpfile(); + overflow_file = tmpfile(); if (overflow_file == NULL) fprintf(rawerrorstream, "warning: could not create overflow file. Output may be truncated.\n");