diff options
author | David <dbphillipsnz@gmail.com> | 2014-06-04 19:54:12 +1200 |
---|---|---|
committer | David <dbphillipsnz@gmail.com> | 2014-06-04 19:54:12 +1200 |
commit | d1e3b814cbb9c08ce5a626445cd2930b13a9893c (patch) | |
tree | 3be25fcb01302bdf2ffc467907436aa6f58958a0 /common.h | |
parent | 2747e2b658b2f27897a80345cb3afb196c0e7c3b (diff) | |
download | paramano-d1e3b814cbb9c08ce5a626445cd2930b13a9893c.tar.xz |
Moved away from manual setting of sudo-ness
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -25,4 +25,24 @@ int get_int_value_from_file(const char* filename); int get_int(const char* string); bool file_has_line(const char *filename, const char *line); +#include <stdio.h> +// <ew> Stringification of line number +#define STRING2(x) #x +#define STRING(x) STRING2(x) +#define STR_LINE STRING(__LINE__) +// </ew> + + +#ifdef DEBUG +/* + Make debug macros into empty space if debug mode's not enabled. + Otherwise, make debug macro calls into appropriate printf()s +*/ + #define debug(...) printf("DEBUG: "__FILE__":"STR_LINE" --- "__VA_ARGS__) +#else + #define debug(...); +#endif + +#define info(...) printf("INFO: "__FILE__":"STR_LINE" --- "__VA_ARGS__) + #endif |