diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-06-29 15:19:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 15:19:31 (GMT) |
commit | fd56a593b7928da636b2494b25cd7478fed78c29 (patch) | |
tree | b815098d8bcf67f4290d3ca74132ce793503b94e /src | |
parent | 8aef67f0ae3e037df22c5319eb2eac8b95521b19 (diff) | |
download | hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.zip hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.tar.gz hdf5-fd56a593b7928da636b2494b25cd7478fed78c29.tar.bz2 |
Remove HD from C std lib file ops (#3206)
* HDfclose
* HDferror
* HDfeof
* HDfflush
* HDfopen
* HDfread
* HDfwrite
Diffstat (limited to 'src')
-rw-r--r-- | src/H5.c | 4 | ||||
-rw-r--r-- | src/H5Clog_json.c | 4 | ||||
-rw-r--r-- | src/H5Clog_trace.c | 4 | ||||
-rw-r--r-- | src/H5Dmpio.c | 8 | ||||
-rw-r--r-- | src/H5FDhdfs.c | 2 | ||||
-rw-r--r-- | src/H5FDlog.c | 4 | ||||
-rw-r--r-- | src/H5FDmirror.c | 4 | ||||
-rw-r--r-- | src/H5FDros3.c | 2 | ||||
-rw-r--r-- | src/H5FDs3comms.c | 42 | ||||
-rw-r--r-- | src/H5FDsplitter.c | 10 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc.c | 8 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5FDioc_threads.c | 4 | ||||
-rw-r--r-- | src/H5FDsubfiling/H5subfiling_common.c | 32 | ||||
-rw-r--r-- | src/H5Rint.c | 2 | ||||
-rw-r--r-- | src/H5Tref.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 21 | ||||
-rw-r--r-- | src/H5trace.c | 2 |
17 files changed, 67 insertions, 88 deletions
@@ -488,7 +488,7 @@ H5_term_library(void) H5_debug_open_stream_t *tmp_open_stream; tmp_open_stream = H5_debug_g.open_stream; - (void)HDfclose(H5_debug_g.open_stream->stream); + (void)fclose(H5_debug_g.open_stream->stream); H5_debug_g.open_stream = H5_debug_g.open_stream->next; (void)H5MM_free(tmp_open_stream); } /* end while */ @@ -753,7 +753,7 @@ H5__debug_mask(const char *s) if (NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { - (void)HDfclose(stream); + (void)fclose(stream); return; } /* end if */ diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c index b2542a9..39ba0ed 100644 --- a/src/H5Clog_json.c +++ b/src/H5Clog_json.c @@ -249,7 +249,7 @@ H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mp HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location); /* Open log file and set it to be unbuffered */ - if (NULL == (json_udata->outfile = HDfopen(file_name, "w"))) + 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); @@ -303,7 +303,7 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info) H5MM_xfree(json_udata->message); /* Close log file */ - if (EOF == HDfclose(json_udata->outfile)) + if (EOF == fclose(json_udata->outfile)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") json_udata->outfile = NULL; diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index be07fa4..91ce691 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -244,7 +244,7 @@ H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int m HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank); /* Open log file and set it to be unbuffered */ - if (NULL == (trace_udata->outfile = HDfopen(file_name, "w"))) + 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); @@ -301,7 +301,7 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info) H5MM_xfree(trace_udata->message); /* Close log file */ - if (EOF == HDfclose(trace_udata->outfile)) + if (EOF == fclose(trace_udata->outfile)) HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") trace_udata->outfile = NULL; diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index ea4d9a4..dd474cc 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -433,7 +433,7 @@ static FILE *debug_stream = NULL; do { \ if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \ fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \ - HDfflush(debug_stream); \ + fflush(debug_stream); \ } \ } while (0) @@ -442,7 +442,7 @@ static FILE *debug_stream = NULL; do { \ if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \ fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \ - HDfflush(debug_stream); \ + fflush(debug_stream); \ } \ } while (0) @@ -1145,7 +1145,7 @@ H5D__piece_io(H5D_io_info_t *io_info) HDsnprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank); - if (NULL == (debug_log_file = HDfopen(debug_log_filename, "a"))) + if (NULL == (debug_log_file = fopen(debug_log_filename, "a"))) HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file") /* Print a short header for this I/O operation */ @@ -1357,7 +1357,7 @@ done: /* Close debugging log file */ if (debug_log_file) { fprintf(debug_log_file, "##############\n\n"); - if (EOF == HDfclose(debug_log_file)) + if (EOF == fclose(debug_log_file)) HDONE_ERROR(H5E_IO, H5E_CLOSEERROR, FAIL, "couldn't close debugging log file") debug_stream = H5DEBUG(D); } diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 00b9b92..ad08e42 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -1158,7 +1158,7 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) br_val, br_suffix, /* raw data bytes */ am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* raw data average */ - HDfflush(stream); + fflush(stream); } done: diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 6dc76cb..cb04903 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -599,7 +599,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Set the log file pointer */ if (fa->logfile) - file->logfp = HDfopen(fa->logfile, "w"); + file->logfp = fopen(fa->logfile, "w"); else file->logfp = stderr; @@ -797,7 +797,7 @@ H5FD__log_close(H5FD_t *_file) if (file->fa.flags & H5FD_LOG_FLAVOR) file->flavor = (unsigned char *)H5MM_xfree(file->flavor); if (file->logfp != stderr) - HDfclose(file->logfp); + fclose(file->logfp); } /* end if */ if (file->fa.logfile) diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index b6997e4..a7baff0 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -122,7 +122,7 @@ typedef struct H5FD_mirror_t { /* end partial line */ \ fprintf(stdout, "\n"); \ fprintf(stdout, "```\n"); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) #else #define LOG_XMIT_BYTES(label, buf, len) /* no-op */ @@ -132,7 +132,7 @@ typedef struct H5FD_mirror_t { #define LOG_OP_CALL(name) \ do { \ printf("called %s()\n", (name)); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) #else #define LOG_OP_CALL(name) /* no-op */ diff --git a/src/H5FDros3.c b/src/H5FDros3.c index ad9825c..2804ef4 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -1048,7 +1048,7 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) am_val, am_suffix, /* metadata average */ ar_val, ar_suffix); /* raw data average */ - HDfflush(stream); + fflush(stream); } done: diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 5d958b5..b3e1620 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -229,7 +229,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) fprintf(stdout, "{%s}\n->", node_ptr->cat); printf("(null)\n"); - HDfflush(stdout); + fflush(stdout); node_ptr = NULL; #endif @@ -302,7 +302,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("CREATE NEW\n"); - HDfflush(stdout); + fflush(stdout); #endif /******************* * CREATE NEW LIST * @@ -333,7 +333,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) { #if S3COMMS_DEBUG printf("REMOVE HEAD\n"); - HDfflush(stdout); + fflush(stdout); #endif /*************** * REMOVE HEAD * @@ -343,39 +343,39 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) #if S3COMMS_DEBUG printf("FREEING CAT (node)\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(node_ptr->cat); #if S3COMMS_DEBUG printf("FREEING LOWERNAME (node)\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(node_ptr->lowername); #if S3COMMS_DEBUG printf("FREEING NAME (node)\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(node_ptr->name); #if S3COMMS_DEBUG printf("FREEING VALUE (node)\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(node_ptr->value); #if S3COMMS_DEBUG printf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); - HDfflush(stdout); + fflush(stdout); #endif assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr->magic += 1ul; #if S3COMMS_DEBUG printf("FREEING POINTER\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(node_ptr); #if S3COMMS_DEBUG printf("FREEING WORKING LOWERNAME\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; @@ -383,7 +383,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("MODIFY HEAD\n"); - HDfflush(stdout); + fflush(stdout); #endif /*************** * MODIFY HEAD * @@ -413,7 +413,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("PREPEND NEW HEAD\n"); - HDfflush(stdout); + fflush(stdout); #endif /******************* * INSERT NEW HEAD * @@ -442,7 +442,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("APPEND A NODE\n"); - HDfflush(stdout); + fflush(stdout); #endif /******************* * APPEND NEW NODE * @@ -465,7 +465,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("INSERT A NODE\n"); - HDfflush(stdout); + fflush(stdout); #endif /******************* * INSERT NEW NODE * @@ -494,7 +494,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) #if S3COMMS_DEBUG printf("REMOVE A NODE\n"); - HDfflush(stdout); + fflush(stdout); #endif H5MM_xfree(tmp->cat); H5MM_xfree(tmp->lowername); @@ -511,7 +511,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) else { #if S3COMMS_DEBUG printf("MODIFY A NODE\n"); - HDfflush(stdout); + fflush(stdout); #endif /***************** * MODIFY A NODE * @@ -2077,12 +2077,12 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") - credfile = HDfopen(filepath, "r"); + credfile = fopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, secret_access_key_out, aws_region_out) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") - if (HDfclose(credfile) == EOF) + if (fclose(credfile) == EOF) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") credfile = NULL; } /* end if credential file opened */ @@ -2090,14 +2090,14 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); if (ret < 0 || (size_t)ret >= 128) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") - credfile = HDfopen(filepath, "r"); + credfile = fopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") - if (HDfclose(credfile) == EOF) + if (fclose(credfile) == EOF) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") credfile = NULL; } /* end if credential file opened */ @@ -2108,7 +2108,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * done: if (credfile != NULL) - if (HDfclose(credfile) == EOF) + if (fclose(credfile) == EOF) HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 70a3caf..c33f083 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -90,7 +90,7 @@ typedef struct H5FD_splitter_t { #define H5FD_SPLITTER_LOG_CALL(name) \ do { \ printf("called %s()\n", (name)); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) #else #define H5FD_SPLITTER_LOG_CALL(name) /* no-op */ @@ -849,7 +849,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha */ if (!file_ptr->logfp) { if (file_ptr->fa.log_file_path[0] != '\0') { - file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w"); + file_ptr->logfp = fopen(file_ptr->fa.log_file_path, "w"); if (file_ptr->logfp == NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file") } /* end if logfile path given */ @@ -880,7 +880,7 @@ done: if (file_ptr->wo_file) H5FD_close(file_ptr->wo_file); if (file_ptr->logfp) - HDfclose(file_ptr->logfp); + fclose(file_ptr->logfp); H5FL_FREE(H5FD_splitter_t, file_ptr); } } /* end if error */ @@ -924,7 +924,7 @@ H5FD__splitter_close(H5FD_t *_file) "unable to close W/O file") if (file->logfp) { - HDfclose(file->logfp); + fclose(file->logfp); file->logfp = NULL; } @@ -1580,7 +1580,7 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const ret_value = FAIL; else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; - else if (size != HDfwrite(s, 1, size, file->logfp)) + else if (size != fwrite(s, 1, size, file->logfp)) ret_value = FAIL; H5MM_free(s); } diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 1cc4f87..7baa334 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -92,7 +92,7 @@ typedef struct H5FD_ioc_t { #define H5FD_IOC_LOG_CALL(name) \ do { \ printf("called %s()\n", (name)); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) #else #define H5FD_IOC_LOG_CALL(name) /* no-op */ @@ -1498,7 +1498,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) HDsnprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino); - if (NULL == (config_file = HDfopen(tmp_filename, "r"))) { + if (NULL == (config_file = fopen(tmp_filename, "r"))) { if (ENOENT == errno) { #ifdef H5FD_IOC_DEBUG printf("** WARNING: couldn't delete Subfiling configuration file '%s'\n", tmp_filename); @@ -1518,7 +1518,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) n_subfiles = (int32_t)read_n_subfiles; /* Delete the Subfiling configuration file */ - if (EOF == HDfclose(config_file)) { + if (EOF == fclose(config_file)) { config_file = NULL; H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close subfiling config file"); @@ -1555,7 +1555,7 @@ H5FD__ioc_del(const char *name, hid_t fapl) done: if (config_file) - if (EOF == HDfclose(config_file)) + if (EOF == fclose(config_file)) H5_SUBFILING_DONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close subfiling config file"); /* Set up a barrier (don't want processes to run ahead of the delete) */ diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c index fad5cf6..84831e1 100644 --- a/src/H5FDsubfiling/H5FDioc_threads.c +++ b/src/H5FDsubfiling/H5FDioc_threads.c @@ -196,7 +196,7 @@ initialize_ioc_threads(void *_sf_context) #ifdef H5FD_IOC_DEBUG if (sf_context->topology->ioc_idx == 0) { printf("%s: time = %lf seconds\n", __func__, (t_end - t_start)); - HDfflush(stdout); + fflush(stdout); } #endif @@ -1178,7 +1178,7 @@ ioc_file_truncate(sf_work_request_t *msg) #ifdef H5FD_IOC_DEBUG printf("[ioc(%d) %s]: truncated subfile to %lld bytes. ret = %d\n", ioc_idx, __func__, (long long)length, errno); - HDfflush(stdout); + fflush(stdout); #endif done: diff --git a/src/H5FDsubfiling/H5subfiling_common.c b/src/H5FDsubfiling/H5subfiling_common.c index 5c8d366..17cde45 100644 --- a/src/H5FDsubfiling/H5subfiling_common.c +++ b/src/H5FDsubfiling/H5subfiling_common.c @@ -673,7 +673,7 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par HDsnprintf(sf_context->sf_logfile_name, PATH_MAX, "%s.log.%d", sf_context->h5_filename, mpi_rank); - if (NULL == (sf_context->sf_logfile = HDfopen(sf_context->sf_logfile_name, "a"))) + if (NULL == (sf_context->sf_logfile = fopen(sf_context->sf_logfile_name, "a"))) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't open subfiling debug logfile"); @@ -903,7 +903,7 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param *context_id_out = context_id; done: - if (config_file && (EOF == HDfclose(config_file))) + if (config_file && (EOF == fclose(config_file))) H5_SUBFILING_DONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "couldn't close subfiling configuration file"); @@ -2305,7 +2305,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c int n_subfiles = sf_context->sf_num_subfiles; int num_digits; - if (NULL == (config_file = HDfopen(config_filename, "w+"))) + if (NULL == (config_file = fopen(config_filename, "w+"))) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't create/truncate subfiling configuration file"); @@ -2315,31 +2315,31 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c /* Write the subfiling stripe size to the configuration file */ HDsnprintf(line_buf, PATH_MAX, "stripe_size=%" PRId64 "\n", sf_context->sf_stripe_size); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the number of I/O concentrators to the configuration file */ HDsnprintf(line_buf, PATH_MAX, "aggregator_count=%d\n", sf_context->topology->n_io_concentrators); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the number of subfiles to the configuration file */ HDsnprintf(line_buf, PATH_MAX, "subfile_count=%d\n", n_subfiles); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the base HDF5 filename to the configuration file */ HDsnprintf(line_buf, PATH_MAX, "hdf5_file=%s\n", sf_context->h5_filename); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); /* Write the optional subfile directory prefix to the configuration file */ HDsnprintf(line_buf, PATH_MAX, "subfile_dir=%s\n", subfile_dir); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); @@ -2349,7 +2349,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c HDsnprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename, sf_context->h5_file_id, num_digits, k + 1, n_subfiles); - if (HDfwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) + if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "failed to write to subfiling configuration file"); } @@ -2357,7 +2357,7 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c done: if (config_file) { - if (EOF == HDfclose(config_file)) + if (EOF == fclose(config_file)) H5_SUBFILING_DONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "couldn't close subfiling configuration file"); } @@ -2426,7 +2426,7 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't check existence of subfiling configuration file"); - if (NULL == (config_file = HDfopen(config_filename, mode))) + if (NULL == (config_file = fopen(config_filename, mode))) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "couldn't open subfiling configuration file"); @@ -2434,7 +2434,7 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil done: if (ret_value < 0) { - if (config_file && (EOF == HDfclose(config_file))) + if (config_file && (EOF == fclose(config_file))) H5_SUBFILING_DONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "couldn't close subfiling configuration file"); } @@ -2482,7 +2482,7 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64 H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for reading from subfiling configuration file"); - if (HDfread(config_buf, (size_t)config_file_len, 1, config_file) != 1) + if (fread(config_buf, (size_t)config_file_len, 1, config_file) != 1) H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "couldn't read from subfiling configuration file"); @@ -2797,7 +2797,7 @@ H5_close_subfiles(int64_t subfiling_context_id, MPI_Comm file_comm) H5_subfiling_log(sf_context->sf_context_id, "\n-- LOGGING FINISH - %s", asctime(tm)); - HDfclose(sf_context->sf_logfile); + fclose(sf_context->sf_logfile); sf_context->sf_logfile = NULL; } #endif @@ -3129,12 +3129,12 @@ H5_subfiling_log(int64_t sf_context_id, const char *fmt, ...) if (sf_context->sf_logfile) { HDvfprintf(sf_context->sf_logfile, fmt, log_args); HDfputs("\n", sf_context->sf_logfile); - HDfflush(sf_context->sf_logfile); + fflush(sf_context->sf_logfile); } else { HDvprintf(fmt, log_args); HDputs(""); - HDfflush(stdout); + fflush(stdout); } H5FD_ioc_end_thread_exclusive(); diff --git a/src/H5Rint.c b/src/H5Rint.c index 9b56b10..2d7f893 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -94,7 +94,7 @@ fprintf(stdout, " # %s(): ", __func__); \ fprintf(stdout, __VA_ARGS__); \ fprintf(stdout, "\n"); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) static const char * H5R__print_token(const H5O_token_t token) diff --git a/src/H5Tref.c b/src/H5Tref.c index 37b3604..aac3634 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -49,7 +49,7 @@ fprintf(stdout, " # %s(): ", __func__); \ fprintf(stdout, __VA_ARGS__); \ fprintf(stdout, "\n"); \ - HDfflush(stdout); \ + fflush(stdout); \ } while (0) #else #define H5T_REF_LOG_DEBUG(...) \ diff --git a/src/H5private.h b/src/H5private.h index 0d1671c..a062ae7 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -650,21 +650,9 @@ typedef off_t h5_stat_size_t; #ifndef HDfabsl #define HDfabsl(X) fabsl(X) #endif -#ifndef HDfclose -#define HDfclose(F) fclose(F) -#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) #endif -#ifndef HDfeof -#define HDfeof(F) feof(F) -#endif -#ifndef HDferror -#define HDferror(F) ferror(F) -#endif -#ifndef HDfflush -#define HDfflush(F) fflush(F) -#endif #ifndef HDfgetc #define HDfgetc(F) fgetc(F) #endif @@ -703,18 +691,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfloor #define HDfloor(X) floor(X) #endif -#ifndef HDfopen -#define HDfopen(S, M) fopen(S, M) -#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) #endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) #endif -#ifndef HDfread -#define HDfread(M, Z, N, F) fread(M, Z, N, F) -#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) #endif @@ -739,9 +721,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) #endif -#ifndef HDfwrite -#define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F) -#endif #ifndef HDgetc #define HDgetc(F) getc(F) #endif diff --git a/src/H5trace.c b/src/H5trace.c index 4f81736..60632de 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -4087,7 +4087,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5RS_acat(rs, ")"); } HDfputs(H5RS_get_str(rs), out); - HDfflush(out); + fflush(out); H5RS_decr(rs); if (H5_debug_g.ttimes) |