include: Make wine_dbg_log() into an inline function.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9911cfdeae
commit
cf8193df5b
|
@ -275,6 +275,38 @@ int __cdecl __wine_dbg_output( const char *str )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_dbg_header (NTDLL.@)
|
||||
*/
|
||||
int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
|
||||
const char *function )
|
||||
{
|
||||
static const char * const classes[] = { "fixme", "err", "warn", "trace" };
|
||||
struct debug_info *info = get_info();
|
||||
char buffer[200], *pos = buffer;
|
||||
|
||||
if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1;
|
||||
|
||||
/* only print header if we are at the beginning of the line */
|
||||
if (info->out_pos > info->output) return 0;
|
||||
|
||||
if (init_done)
|
||||
{
|
||||
if (TRACE_ON(timestamp))
|
||||
{
|
||||
ULONG ticks = NtGetTickCount();
|
||||
pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 );
|
||||
}
|
||||
if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", GetCurrentProcessId() );
|
||||
pos += sprintf( pos, "%04x:", GetCurrentThreadId() );
|
||||
}
|
||||
if (function && cls < ARRAY_SIZE( classes ))
|
||||
snprintf( pos, sizeof(buffer) - (pos - buffer), "%s:%s:%s ",
|
||||
classes[cls], channel->name, function );
|
||||
|
||||
return append_output( info, buffer, strlen( buffer ));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NTDLL_dbg_vprintf
|
||||
*/
|
||||
|
|
|
@ -1507,6 +1507,7 @@
|
|||
|
||||
# Debugging
|
||||
@ cdecl -norelay __wine_dbg_get_channel_flags(ptr)
|
||||
@ cdecl -norelay __wine_dbg_header(long long str)
|
||||
@ cdecl -norelay __wine_dbg_output(str)
|
||||
@ cdecl -norelay __wine_dbg_strdup(str)
|
||||
|
||||
|
|
|
@ -161,6 +161,8 @@ extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_f
|
|||
struct __wine_debug_functions *old_funcs, size_t size );
|
||||
extern const char * __cdecl __wine_dbg_strdup( const char *str );
|
||||
extern int __cdecl __wine_dbg_output( const char *str );
|
||||
extern int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
|
||||
const char *function );
|
||||
|
||||
/*
|
||||
* Exported definitions and macros
|
||||
|
@ -170,9 +172,6 @@ extern int __cdecl __wine_dbg_output( const char *str );
|
|||
quotes. The string will be valid for some time, but not indefinitely
|
||||
as strings are re-used. */
|
||||
|
||||
extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func,
|
||||
const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
|
||||
|
||||
#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
|
||||
# define __wine_dbg_cdecl __cdecl
|
||||
# define __wine_dbg_va_list __builtin_ms_va_list
|
||||
|
@ -209,6 +208,31 @@ static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... )
|
|||
return __wine_dbg_output( buffer );
|
||||
}
|
||||
|
||||
static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
|
||||
struct __wine_debug_channel *channel, const char *func,
|
||||
const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
|
||||
static inline int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
|
||||
struct __wine_debug_channel *channel,
|
||||
const char *function, const char *format, ... )
|
||||
{
|
||||
char buffer[1024];
|
||||
__wine_dbg_va_list args;
|
||||
int ret;
|
||||
|
||||
if (*format == '\1') /* special magic to avoid standard prefix */
|
||||
{
|
||||
format++;
|
||||
function = NULL;
|
||||
}
|
||||
if ((ret = __wine_dbg_header( cls, channel, function )) == -1) return ret;
|
||||
|
||||
__wine_dbg_va_start( args, format );
|
||||
vsnprintf( buffer, sizeof(buffer), format, args );
|
||||
__wine_dbg_va_end( args );
|
||||
ret += __wine_dbg_output( buffer );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline const char *wine_dbgstr_an( const char *str, int n )
|
||||
{
|
||||
static const char hex[16] = "0123456789abcdef";
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define __wine_dbg_get_channel_flags __wine_dbg_get_channel_flags_inline
|
||||
#define wine_dbg_sprintf wine_dbg_sprintf_inline
|
||||
#define wine_dbg_printf wine_dbg_printf_inline
|
||||
#define wine_dbg_log wine_dbg_log_inline
|
||||
#define wine_dbgstr_an wine_dbgstr_an_inline
|
||||
#define wine_dbgstr_wn wine_dbgstr_wn_inline
|
||||
#include "wine/debug.h"
|
||||
|
@ -252,6 +253,7 @@ const char *wine_dbg_sprintf( const char *format, ... )
|
|||
|
||||
|
||||
/* varargs wrapper for funcs.dbg_vlog */
|
||||
#undef wine_dbg_log
|
||||
int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
|
||||
const char *func, const char *format, ... )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue