From 96742389f69d610719440793a88f818287dcd7b0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 30 Aug 2022 18:33:11 +0200 Subject: [PATCH] include: Add va_list version of the debug printf functions. --- include/wine/debug.h | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/include/wine/debug.h b/include/wine/debug.h index 74034025618..115f5c396b9 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -168,28 +168,46 @@ extern int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine # define __wine_dbg_cdecl #endif +static const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0); +static inline const char * __wine_dbg_cdecl wine_dbg_vsprintf( const char *format, va_list args ) +{ + char buffer[200]; + + vsnprintf( buffer, sizeof(buffer), format, args ); + return __wine_dbg_strdup( buffer ); +} + static const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) { - char buffer[200]; + const char *ret; va_list args; va_start( args, format ); - vsnprintf( buffer, sizeof(buffer), format, args ); + ret = wine_dbg_vsprintf( format, args ); va_end( args ); - return __wine_dbg_strdup( buffer ); + return ret; +} + +static int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0); +static inline int __wine_dbg_cdecl wine_dbg_vprintf( const char *format, va_list args ) +{ + char buffer[1024]; + + vsnprintf( buffer, sizeof(buffer), format, args ); + return __wine_dbg_output( buffer ); } static int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) { - char buffer[1024]; + int ret; va_list args; va_start( args, format ); - vsnprintf( buffer, sizeof(buffer), format, args ); + ret = wine_dbg_vprintf( format, args ); va_end( args ); - return __wine_dbg_output( buffer ); + return ret; } static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,