From a64f2ce03a168da774e564019aeaed829c9f918b Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 22 Jun 2016 15:19:23 +0200 Subject: [PATCH] src/h5core/h5_err.c src/h5core/h5_log.c: - define args as const where possible - h5_verror() is now in h5_err.c - h5priv_vprintf() is now in h5_log.c --- src/h5core/h5_err.c | 54 +++++++++++++++++++-------------------------- src/h5core/h5_log.c | 21 ------------------ 2 files changed, 23 insertions(+), 52 deletions(-) diff --git a/src/h5core/h5_err.c b/src/h5core/h5_err.c index c5333a7..2ff2ad4 100644 --- a/src/h5core/h5_err.c +++ b/src/h5core/h5_err.c @@ -89,6 +89,26 @@ h5_set_errno ( h5_errno = errno; } +/*! + \ingroup h5_core_errorhandling + + Print error message to \c stderr. For use in error handlers only. + */ +void +h5_verror ( + const char* const fmt, + va_list ap + ) { + if (h5_log_level == 0) return; + char fmt2[2048]; + snprintf (fmt2, + sizeof(fmt2), "[proc %d] E: %s: %s\n", + h5_myproc, + h5_call_stack.entry[0].name, + fmt); + vfprintf (stderr, fmt2, ap); + +} /*! \ingroup h5_core_errorhandling @@ -100,7 +120,7 @@ h5_set_errno ( */ h5_err_t h5_report_errorhandler ( - const char* fmt, + const char* const fmt, va_list ap ) { if (h5_log_level > 0) { @@ -117,7 +137,7 @@ h5_report_errorhandler ( */ h5_err_t h5_abort_errorhandler ( - const char* fmt, + const char* const fmt, va_list ap ) { if (h5_log_level > 0) { @@ -131,20 +151,6 @@ h5_abort_errorhandler ( return -(int)h5_errno; // never executed, just to supress a warning } -void -h5priv_vprintf ( - FILE* f, - const char* prefix, - const char* __funcname, - const char* fmt, - va_list ap - ) { - char fmt2[2048]; - snprintf (fmt2, sizeof(fmt2), "[proc %d] %s: %s: %s\n", h5_myproc, prefix, - __funcname, fmt); - vfprintf (f, fmt2, ap); -} - /*! \ingroup h5_core_errorhandling @@ -155,7 +161,7 @@ h5priv_vprintf ( h5_err_t h5_error ( const h5_err_t errno_, - const char* fmt, + const char* const fmt, ... ) { h5_errno = errno_; @@ -167,17 +173,3 @@ h5_error ( va_end (ap); return h5_errno; } - -/*! - \ingroup h5_core_errorhandling - - Print error message to \c stderr. For use in error handlers only. - */ -void -h5_verror ( - const char* fmt, - va_list ap - ) { - if (h5_log_level == 0) return; - h5priv_vprintf (stderr, "E", h5_call_stack.entry[0].name, fmt, ap); -} diff --git a/src/h5core/h5_log.c b/src/h5core/h5_log.c index 815df54..cc766a1 100644 --- a/src/h5core/h5_log.c +++ b/src/h5core/h5_log.c @@ -93,27 +93,6 @@ h5priv_vprintf ( vfprintf (f, fmt2, ap); } -/*! - \ingroup h5_core_errorhandling - - Print error message to \c stderr. For use in error handlers only. - */ -void -h5_verror ( - const char* const fmt, - va_list ap - ) { - if (h5_log_level == 0) return; - char fmt2[2048]; - snprintf (fmt2, - sizeof(fmt2), "[proc %d] E: %s: %s\n", - h5_myproc, - h5_call_stack.entry[0].name, - fmt); - vfprintf (stderr, fmt2, ap); - -} - h5_err_t h5_warn ( const char* fmt,