Introduce macro for printing the debug messages
marktwtn opened this issue · comments
marktwtn commented
Base on the discussion of #143 (comment), the way to print the debug messages should be simplified.
The original code
#if defined(ENABLE_DEBUG)
printf(......);
#endif
would be replaced with the macro
DPRINTF(...);
The DPRINTF(...)
macro implementation is
#if defined(ENABLE_DEBUG)
#define DPRINTF(...) printf(__VA_ARGS__)
#else
#define DPRINTF(...)
#endif
It will be written in the src/common.h
and allow other dcurl
source code to use it.
Jim Huang commented
How about using inline function(s) instead? Compiler optimization can eliminate dead code effectively, and inline functions usually perform more type checking. Messages generated by dprintf
can be redirected to internal logging system.