Move debug printing helpers to util header - noice - small file browser (mirror / fork from 2f30.org)
 (HTM) git clone git://git.codemadness.org/noice
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 6b1ec1959954145d7942ba3b7e65f5cde30485a1
 (DIR) parent 16f473f55cd1510d6a641f860197a8c79ea57f23
 (HTM) Author: Lazaros Koromilas <lostd@2f30.org>
       Date:   Mon,  8 Apr 2019 12:42:43 +0300
       
       Move debug printing helpers to util header
       
       Diffstat:
         M noice.c                             |      14 --------------
         M util.h                              |      15 +++++++++++++++
       
       2 files changed, 15 insertions(+), 14 deletions(-)
       ---
 (DIR) diff --git a/noice.c b/noice.c
       @@ -20,19 +20,6 @@
        
        #include "util.h"
        
       -#ifdef DEBUG
       -#define DEBUG_FD 8
       -#define DPRINTF_D(x) dprintf(DEBUG_FD, #x "=%d\n", x)
       -#define DPRINTF_U(x) dprintf(DEBUG_FD, #x "=%u\n", x)
       -#define DPRINTF_S(x) dprintf(DEBUG_FD, #x "=%s\n", x)
       -#define DPRINTF_P(x) dprintf(DEBUG_FD, #x "=0x%p\n", x)
       -#else
       -#define DPRINTF_D(x)
       -#define DPRINTF_U(x)
       -#define DPRINTF_S(x)
       -#define DPRINTF_P(x)
       -#endif /* DEBUG */
       -
        #define NR_ARGS        32
        #define LEN(x) (sizeof(x) / sizeof(*(x)))
        #undef MIN
       @@ -117,7 +104,6 @@ void printmsg(char *);
        void printwarn(void);
        void printerr(int, char *);
        
       -#undef dprintf
        int
        dprintf(int fd, const char *fmt, ...)
        {
 (DIR) diff --git a/util.h b/util.h
       @@ -3,3 +3,18 @@
        size_t strlcat(char *, const char *, size_t);
        #undef strlcpy
        size_t strlcpy(char *, const char *, size_t);
       +#undef dprintf
       +int dprintf(int, const char *, ...);
       +
       +#ifdef DEBUG
       +#define DEBUG_FD 8
       +#define DPRINTF_D(x) dprintf(DEBUG_FD, #x "=%d\n", x)
       +#define DPRINTF_U(x) dprintf(DEBUG_FD, #x "=%u\n", x)
       +#define DPRINTF_S(x) dprintf(DEBUG_FD, #x "=%s\n", x)
       +#define DPRINTF_P(x) dprintf(DEBUG_FD, #x "=0x%p\n", x)
       +#else
       +#define DPRINTF_D(x)
       +#define DPRINTF_U(x)
       +#define DPRINTF_S(x)
       +#define DPRINTF_P(x)
       +#endif /* DEBUG */