Mercurial > trustbridge
changeset 230:92b1e5ed2d5f
Cleanup and documentation in debugging macros.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 28 Mar 2014 10:32:55 +0100 |
parents | e99e39d72af2 |
children | c342b93c5bd1 |
files | cinst/mozilla.c common/debug.h |
diffstat | 2 files changed, 26 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/cinst/mozilla.c Fri Mar 28 10:12:14 2014 +0100 +++ b/cinst/mozilla.c Fri Mar 28 10:32:55 2014 +0100 @@ -59,12 +59,13 @@ #include <string.h> #include <sys/types.h> +#define DEBUGPREFIX "MOZ-" #include "debug.h" + #include "errorcodes.h" #include "portpath.h" #include "strhelp.h" -#define DEBUGPREFIX "MOZ-" #ifndef _WIN32 #define CONFDIRS ".mozilla", ".thunderbird"
--- a/common/debug.h Fri Mar 28 10:12:14 2014 +0100 +++ b/common/debug.h Fri Mar 28 10:32:55 2014 +0100 @@ -2,16 +2,37 @@ #define DEBUG_H /** - * @file debug.h + * @file * @brief Helper macros for debugging */ /** + * @def DEBUGOUTPUT + * @brief If defined code for extra debugging output will be generated. + * + * Will be defined if current build is not an RELEASE_BUILD. + */ +#ifndef RELEASE_BUILD +#define DEBUGOUTPUT +#endif + +/** + * @def DEBUGPREFIX + * @brief A string prepended to debug output. + * + * Should be defined to indicate which module created the output. + */ +#ifndef DEBUGPREFIX +#define DEBUGPREFIX "" +#endif + +/** + * @def DEBUGPRINTF(fmt, ...) * @brief Debug printf * - * Prints to stderr if RELEASE_BUILD is not defined. + * Prints to stderr if DEBUGOUTPUT is defined. */ -#ifndef RELEASE_BUILD +#ifdef DEBUGOUTPUT #define DEBUGPRINTF(fmt, ...) fprintf(stderr, DEBUGPREFIX "DEBUG: " fmt, ##__VA_ARGS__); #else #define DEBUGPRINTF(fmt, ...)