Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ddf1ff2f
Commit
ddf1ff2f
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Make wine_dbg_printf() into an inline function.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f2e6f05f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
1 deletion
+50
-1
debugtools.c
dlls/ntdll/debugtools.c
+34
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
debug.h
include/wine/debug.h
+13
-1
debug.c
libs/wine/debug.c
+2
-0
No files found.
dlls/ntdll/debugtools.c
View file @
ddf1ff2f
...
...
@@ -74,6 +74,20 @@ static void release_temp_buffer( char *ptr, size_t size )
info
->
str_pos
=
ptr
+
size
;
}
/* add a string to the output buffer */
static
int
append_output
(
struct
debug_info
*
info
,
const
char
*
str
,
size_t
len
)
{
if
(
len
>=
sizeof
(
info
->
output
)
-
(
info
->
out_pos
-
info
->
output
))
{
fprintf
(
stderr
,
"wine_dbg_output: debugstr buffer overflow (contents: '%s')
\n
"
,
info
->
output
);
info
->
out_pos
=
info
->
output
;
abort
();
}
memcpy
(
info
->
out_pos
,
str
,
len
);
info
->
out_pos
+=
len
;
return
len
;
}
/***********************************************************************
* __wine_dbg_strdup (NTDLL.@)
*/
...
...
@@ -89,6 +103,26 @@ const char * __cdecl __wine_dbg_strdup( const char *str )
}
/***********************************************************************
* __wine_dbg_output (NTDLL.@)
*/
int
__cdecl
__wine_dbg_output
(
const
char
*
str
)
{
struct
debug_info
*
info
=
get_info
();
const
char
*
end
=
strrchr
(
str
,
'\n'
);
int
ret
=
0
;
if
(
end
)
{
ret
+=
append_output
(
info
,
str
,
end
+
1
-
str
);
write
(
2
,
info
->
output
,
info
->
out_pos
-
info
->
output
);
info
->
out_pos
=
info
->
output
;
str
=
end
+
1
;
}
if
(
*
str
)
ret
+=
append_output
(
info
,
str
,
strlen
(
str
));
return
ret
;
}
/***********************************************************************
* NTDLL_dbg_vprintf
*/
static
int
NTDLL_dbg_vprintf
(
const
char
*
format
,
va_list
args
)
...
...
dlls/ntdll/ntdll.spec
View file @
ddf1ff2f
...
...
@@ -1506,6 +1506,7 @@
@ cdecl __wine_make_process_system()
# Debugging
@ cdecl -norelay __wine_dbg_output(str)
@ cdecl -norelay __wine_dbg_strdup(str)
# Virtual memory
...
...
include/wine/debug.h
View file @
ddf1ff2f
...
...
@@ -162,6 +162,7 @@ extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel,
extern
void
__wine_dbg_set_functions
(
const
struct
__wine_debug_functions
*
new_funcs
,
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
);
/*
* Exported definitions and macros
...
...
@@ -171,7 +172,6 @@ extern const char * __cdecl __wine_dbg_strdup( const char *str );
quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */
extern
int
wine_dbg_printf
(
const
char
*
format
,
...
)
__WINE_PRINTF_ATTR
(
1
,
2
);
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
);
...
...
@@ -199,6 +199,18 @@ static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format
return
__wine_dbg_strdup
(
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
];
__wine_dbg_va_list
args
;
__wine_dbg_va_start
(
args
,
format
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
args
);
__wine_dbg_va_end
(
args
);
return
__wine_dbg_output
(
buffer
);
}
static
inline
const
char
*
wine_dbgstr_an
(
const
char
*
str
,
int
n
)
{
static
const
char
hex
[
16
]
=
"0123456789abcdef"
;
...
...
libs/wine/debug.c
View file @
ddf1ff2f
...
...
@@ -31,6 +31,7 @@
#endif
#define wine_dbg_sprintf wine_dbg_sprintf_inline
#define wine_dbg_printf wine_dbg_printf_inline
#define wine_dbgstr_an wine_dbgstr_an_inline
#define wine_dbgstr_wn wine_dbgstr_wn_inline
#include "wine/debug.h"
...
...
@@ -217,6 +218,7 @@ static void debug_init(void)
}
/* varargs wrapper for funcs.dbg_vprintf */
#undef wine_dbg_printf
int
wine_dbg_printf
(
const
char
*
format
,
...
)
{
int
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment