Am Sonntag 31 Dezember 2006 16:30 schrieb Marcel Holtmann:
> > debug-output.patch:
> >   - flatten the macro structure
> >   - adapt for win32
>
> can you explain the basic idea behind your patch. The overall debugging
> code is kinda messy since it has been grown by different parties.

Happy New Year for the beginning :)

I first define a log function that maps to either fprintf() or syslog(). The 
DEBUG macro then can make use of it. It also avoids other parts of the code 
to have ifdefs for such thing as they can always use the log_debug() function 
directly.
Example here is databuffer.c. The other code that uses syslog() was not 
updated as it doesn't get compiled.

Idea behind this: nested ifdefs are very evil and can get unmaintainable 
pretty fast.

This patch also obsoletes code because macros that are not defined are always 
0. This means that:
#if SOME_MACRO
....

is totally equal to
#ifndef SOME_MACRO
#define SOME_MACRO 0
#endif
#if SOME_MACRO
...

Additionally, WIN32 _may_ get another implementation for log_debug that uses 
the event mechnism of windows but that's a different story ;)
Currently, fprintf() debug output is forced for WIN32 when debugging is 
enabled as syslog damons are not a usual thing, there.

The syslog stuff is questionable anyway as normal users have no access rights 
on syslog log files.

Currently, the patch is a pure cleanup, no functionality is added or changed.

HS

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to