Return the previous sys print callbacks

This allows for temporary overrides.
This commit is contained in:
Bill Currie 2020-02-23 11:41:19 +09:00
parent 52d54f98bf
commit f8b1a3a89f
2 changed files with 8 additions and 4 deletions

View file

@ -65,8 +65,8 @@ int Sys_mkdir (const char *path);
typedef void (*sys_printf_t) (const char *fmt, va_list args) __attribute__((format(printf, 1, 0)));
typedef void (*sys_error_t) (void *data);
void Sys_SetStdPrintf (sys_printf_t func);
void Sys_SetErrPrintf (sys_printf_t func);
sys_printf_t Sys_SetStdPrintf (sys_printf_t func);
sys_printf_t Sys_SetErrPrintf (sys_printf_t func);
void Sys_PushErrorHandler (sys_error_t func, void *data);
void Sys_PopErrorHandler (void);

View file

@ -240,16 +240,20 @@ Sys_FileExists (const char *path)
for want of a better name, but it sets the function pointer for the
actual implementation of Sys_Printf.
*/
VISIBLE void
VISIBLE sys_printf_t
Sys_SetStdPrintf (sys_printf_t func)
{
sys_printf_t prev = sys_std_printf_function;
sys_std_printf_function = func;
return prev;
}
VISIBLE void
VISIBLE sys_printf_t
Sys_SetErrPrintf (sys_printf_t func)
{
sys_printf_t prev = sys_err_printf_function;
sys_err_printf_function = func;
return prev;
}
void