From 612ae13c83235092d100b8ee86c5b7425aa36c36 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 28 Oct 2022 01:27:58 +0100 Subject: move debug macros to a different header file --- conf.h | 18 ------------------ debug.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 debug.h diff --git a/conf.h b/conf.h index 96fbce5..c405d11 100644 --- a/conf.h +++ b/conf.h @@ -1,10 +1,6 @@ #ifndef conf_h_INCLUDED #define conf_h_INCLUDED -#include -#include -#include - #ifdef LOCAL #define HOST "0.0.0.0" #define PORT "6971" @@ -17,20 +13,6 @@ #define SOCKETGROUP "apionet" #endif -#ifdef DEBUG - #define DP(x) puts(x) - #define DPn(name,x,len) \ - do { \ - char *__xxx = strndup(x,len); \ - printf(name " [%s]\n",__xxx); \ - free(__xxx); \ - } while (0) - #define DPf(...) fprintf(stderr,__VA_ARGS__) -#else - #define DP(x) - #define DPn(n,x,l) - #define DPf(...) -#endif #define NICK "Bee" #define USERNAME "apiobot" diff --git a/debug.h b/debug.h new file mode 100644 index 0000000..25bb859 --- /dev/null +++ b/debug.h @@ -0,0 +1,30 @@ +#ifndef debug_h_INCLUDED +#define debug_h_INCLUDED + + +#ifdef DEBUG + +#include +#include +#include + +#define DP(x) puts(x) +#define DPn(name,x,len) \ + do { \ + char *__xxx = strndup(x,len); \ + printf(name " [%s]\n",__xxx); \ + free(__xxx); \ + } while (0) +#define DPf(...) fprintf(stderr,__VA_ARGS__) + + +#else + +#define DP(x) +#define DPn(n,x,l) +#define DPf(...) + +#endif + +#endif // debug_h_INCLUDED + -- cgit v1.2.3