From ac11b9154044b0a615a5d37546377f9f81c59f06 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 29 Aug 2022 10:48:21 -0700 Subject: [PATCH] Remove return values from `vlog_*` functions They weren't ever being used, and nobody really ever uses the return value from the printf family of functions anyway. They return how many bytes were actually printed, but if it's less than you expected then there's not much you can really do about them. Also the vlog_* functions were computing them inaccurately because I only set the return value to the return value of vprintf when there's other print functions being called, but regardless there's no reason to have a return value here anyway. --- desktop_version/src/Vlogging.c | 36 ++++++++++++---------------------- desktop_version/src/Vlogging.h | 8 ++++---- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/desktop_version/src/Vlogging.c b/desktop_version/src/Vlogging.c index e5383943..c5114ee9 100644 --- a/desktop_version/src/Vlogging.c +++ b/desktop_version/src/Vlogging.c @@ -64,14 +64,13 @@ void vlog_toggle_error(const int enable_error) error_enabled = enable_error; } -SDL_PRINTF_VARARG_FUNC(1) int vlog_debug(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) void vlog_debug(const char* text, ...) { va_list list; - int retval; if (!output_enabled || !debug_enabled) { - return 0; + return; } printf(Color_BOLD_GRAY); @@ -80,22 +79,19 @@ SDL_PRINTF_VARARG_FUNC(1) int vlog_debug(const char* text, ...) printf(" "); va_start(list, text); - retval = vprintf(text, list); + vprintf(text, list); va_end(list); putchar('\n'); - - return retval; } -SDL_PRINTF_VARARG_FUNC(1) int vlog_info(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) void vlog_info(const char* text, ...) { va_list list; - int retval; if (!output_enabled || !info_enabled) { - return 0; + return; } printf(Color_BOLD); @@ -104,22 +100,19 @@ SDL_PRINTF_VARARG_FUNC(1) int vlog_info(const char* text, ...) printf(" "); va_start(list, text); - retval = vprintf(text, list); + vprintf(text, list); va_end(list); putchar('\n'); - - return retval; } -SDL_PRINTF_VARARG_FUNC(1) int vlog_warn(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) void vlog_warn(const char* text, ...) { va_list list; - int retval; if (!output_enabled || !warn_enabled) { - return 0; + return; } fprintf(stderr, Color_BOLD_YELLOW); @@ -128,22 +121,19 @@ SDL_PRINTF_VARARG_FUNC(1) int vlog_warn(const char* text, ...) fprintf(stderr, " "); va_start(list, text); - retval = vfprintf(stderr, text, list); + vfprintf(stderr, text, list); va_end(list); fputc('\n', stderr); - - return retval; } -SDL_PRINTF_VARARG_FUNC(1) int vlog_error(const char* text, ...) +SDL_PRINTF_VARARG_FUNC(1) void vlog_error(const char* text, ...) { va_list list; - int retval; if (!output_enabled || !error_enabled) { - return 0; + return; } fprintf(stderr, Color_BOLD_RED); @@ -152,10 +142,8 @@ SDL_PRINTF_VARARG_FUNC(1) int vlog_error(const char* text, ...) fprintf(stderr, " "); va_start(list, text); - retval = vfprintf(stderr, text, list); + vfprintf(stderr, text, list); va_end(list); fputc('\n', stderr); - - return retval; } diff --git a/desktop_version/src/Vlogging.h b/desktop_version/src/Vlogging.h index 6135d598..70bc6f09 100644 --- a/desktop_version/src/Vlogging.h +++ b/desktop_version/src/Vlogging.h @@ -22,13 +22,13 @@ void vlog_toggle_warn(int enable_warn); void vlog_toggle_error(int enable_error); -SDL_PRINTF_VARARG_FUNC(1) int vlog_debug(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) void vlog_debug(const char* text, ...); -SDL_PRINTF_VARARG_FUNC(1) int vlog_info(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) void vlog_info(const char* text, ...); -SDL_PRINTF_VARARG_FUNC(1) int vlog_warn(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) void vlog_warn(const char* text, ...); -SDL_PRINTF_VARARG_FUNC(1) int vlog_error(const char* text, ...); +SDL_PRINTF_VARARG_FUNC(1) void vlog_error(const char* text, ...); #ifdef __cplusplus } /* extern "C" */