From a48cd50a8beb535c24856b1c823e0c887d4803ee Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 1 Mar 2021 21:25:09 +0100 Subject: [PATCH] [error] const char * for fmt --- src/util/error.c | 16 ++++++++-------- src/util/error.h | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/util/error.c b/src/util/error.c index 05e42a2cd..b8e58344c 100644 --- a/src/util/error.c +++ b/src/util/error.c @@ -38,7 +38,7 @@ char full_static_version[1024] = "ELinks " VERSION_STRING; static void -er(int bell, int shall_sleep, char *fmt, va_list params) +er(int bell, int shall_sleep, const char *fmt, va_list params) { if (bell) #ifdef CONFIG_OS_WIN32 @@ -56,7 +56,7 @@ int errline; const char *errfile; void -elinks_debug(char *fmt, ...) +elinks_debug(const char *fmt, ...) { char errbuf[4096]; va_list params; @@ -72,7 +72,7 @@ elinks_debug(char *fmt, ...) } void -elinks_wdebug(char *fmt, ...) +elinks_wdebug(const char *fmt, ...) { char errbuf[4096]; va_list params; @@ -88,7 +88,7 @@ elinks_wdebug(char *fmt, ...) } void -elinks_error(char *fmt, ...) +elinks_error(const char *fmt, ...) { char errbuf[4096]; va_list params; @@ -104,7 +104,7 @@ elinks_error(char *fmt, ...) } void -elinks_internal(char *fmt, ...) +elinks_internal(const char *fmt, ...) { char errbuf[4096]; va_list params; @@ -125,7 +125,7 @@ elinks_internal(char *fmt, ...) void -usrerror(char *fmt, ...) +usrerror(const char *fmt, ...) { va_list params; @@ -143,7 +143,7 @@ usrerror(char *fmt, ...) int assert_failed = 0; void -elinks_assertm(int x, char *fmt, ...) +elinks_assertm(int x, const char *fmt, ...) { char *buf = NULL; va_list params; @@ -201,7 +201,7 @@ done_log(void) void elinks_log(char *msg, char *file, int line, - char *fmt, ...) + const char *fmt, ...) { static char *log_files = NULL; static char *log_msg = NULL; diff --git a/src/util/error.h b/src/util/error.h index 0c2c3a00d..790cee006 100644 --- a/src/util/error.h +++ b/src/util/error.h @@ -23,7 +23,7 @@ extern const char *errfile; * lying there commented out, as it may get handy). */ #undef DBG #define DBG errfile = __FILE__, errline = __LINE__, elinks_debug -void elinks_debug(char *fmt, ...); +void elinks_debug(const char *fmt, ...); /** @c WDBG(format_string) is used for printing of debugging information, akin * to DBG(). However, it sleep(1)s, therefore being useful when it is going @@ -32,7 +32,7 @@ void elinks_debug(char *fmt, ...); * handy). */ #undef WDBG #define WDBG errfile = __FILE__, errline = __LINE__, elinks_wdebug -void elinks_wdebug(char *fmt, ...); +void elinks_wdebug(const char *fmt, ...); /** @c ERROR(format_string) is used to report non-fatal unexpected errors during * the ELinks run. It tries to (not that agressively) draw user's attention to @@ -42,20 +42,20 @@ void elinks_wdebug(char *fmt, ...); * this kind of stuff, and there's nothing naughty about using that. */ #undef ERROR #define ERROR errfile = __FILE__, errline = __LINE__, elinks_error -void elinks_error(char *fmt, ...); +void elinks_error(const char *fmt, ...); /** @c INTERNAL(format_string) is used to report fatal errors during the ELinks * run. It tries to draw user's attention to the error and dumps core if ELinks * is running in the CONFIG_DEBUG mode. */ #undef INTERNAL #define INTERNAL errfile = __FILE__, errline = __LINE__, elinks_internal -void elinks_internal(char *fmt, ...); +void elinks_internal(const char *fmt, ...); /** @c usrerror(format_string) is used to report user errors during a peaceful * ELinks run. It does not belong to the family above - it doesn't print code * location, beep nor sleep, it just wraps around fprintf(stderr, "...\n");. */ -void usrerror(char *fmt, ...); +void usrerror(const char *fmt, ...); #ifdef HAVE_VARIADIC_MACROS @@ -75,7 +75,7 @@ void usrerror(char *fmt, ...); */ void elinks_log(char *msg, char *file, int line, - char *fmt, ...); + const char *fmt, ...); #undef LOG_ERR #define LOG_ERR(args...) \ @@ -147,7 +147,7 @@ do { if (!assert_failed && (assert_failed = !(x))) { \ #ifdef CONFIG_FASTMEM static inline #endif -void elinks_assertm(int x, char *fmt, ...) +void elinks_assertm(int x, const char *fmt, ...) #ifdef CONFIG_FASTMEM { /* We don't do anything in CONFIG_FASTMEM mode. Let's hope that the compiler