Get rid of DPRINTF in x11drv/opengl.c

Dimitrie O. Paun dpaun at rogers.com
Thu Dec 30 10:10:19 CST 2004


On Thu, Dec 30, 2004 at 12:04:23PM +0100, Diego 'Flameeyes' Pettenò wrote:
> I had some spare time, and I wanted to do some mostly non-designing code, so I 
> took the time to look at wine's janitorial projects, and I took a look at the 
> DPRINTF -> TRACE conversion.
> 
> The attached patch removes DPRINTFs from x11drv/opengl.c (which is the only 
> file in x11drv which uses them), and replacing the 6 different following 
> calls with a single call for bits and buffer counters.

This is a good project to work on, but the reason it's not done yet
it's because it is not a simple replacement of DPRINTF with TRACE.
Doing stuff like:
+  TRACE("  - size / version : %d / %d\n", ppfd->nSize, ppfd->nVersion);
+  TRACE("  - dwFlags : ");

Will not work correctly in a multitreaded environment, where the
lines may get intertwinded on output with statements from other
threads.

The way to do it is to prepare the output in a memory buffer, and
output it at once. This can be done with the wine_dbg_sprintf()
function. In cases where you need logic to construct the output
(like testing for flags, etc), you can do it by first printing
to a local buffer, and then printing the content of the buffer
to a debug buffer via wine_dbg_sprintf(). A simple example of this
technique can be found in the dlls/kernel/locale.c file, in the
debugstr_lang() function.

-- 
Dimi.



-- 
Dimi.



More information about the wine-devel mailing list