00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #pragma once
00029 #ifndef OSCAP_DEBUG_PRIV_H_
00030 #define OSCAP_DEBUG_PRIV_H_
00031
00032 #include "util.h"
00033 #include "public/debug.h"
00034
00035 OSCAP_HIDDEN_START;
00036
00037 #ifndef oscap_dprintf
00038 #if defined(NDEBUG)
00039 # define oscap_dprintf(...) while(0)
00040 #else
00041 # include <stddef.h>
00042 # include <stdarg.h>
00051 void __oscap_dprintf(const char *srcfile, const char *srcfn, size_t line, const char *fmt, ...);
00052
00058 # define oscap_dprintf(...) __oscap_dprintf (__FILE__, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__)
00059 #endif
00060 #endif
00061
00062
00063 #ifndef NDEBUG
00064 #include <stdlib.h>
00065 extern int __debuglog_level;
00066
00080 # define debug(l) if ((__debuglog_level = (__debuglog_level == -1 ? atoi (getenv (OSCAP_DEBUG_LEVEL_ENV) == NULL ? "0" : getenv (OSCAP_DEBUG_LEVEL_ENV)) : __debuglog_level)) && __debuglog_level >= (l))
00081 #else
00082 # define debug(l) if (0)
00083 #endif
00084
00091 #define oscap_dlprintf(l, ...) do { debug(l) { oscap_dprintf(__VA_ARGS__); }} while(0)
00092
00093 OSCAP_HIDDEN_END;
00094
00095 #endif