1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 09:39:43 +01:00

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.
This commit is contained in:
Misa 2022-08-29 10:48:21 -07:00
parent 3bb3976e7e
commit ac11b91540
2 changed files with 16 additions and 28 deletions

View file

@ -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;
}

View file

@ -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" */