From: Marcel H. <ma...@ho...> - 2007-01-02 17:48:17
|
Hi Hendrik, > > > 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. the more I looked into this, the more I think this stuff needs a massive cleanup. It is a grown debug structure and it is not really helpful and simple at the moment. Any ideas or should I go with your patch for now? Regards Marcel |