From: Hallvard B Furuseth Date: Wed, 29 Jun 2011 16:47:08 +0000 (+0200) Subject: DPRINTF(): Fix format, handle non-gcc, simplify. X-Git-Tag: OPENLDAP_REL_ENG_2_4_27~148^2~172 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=86b40907d4e81225b016c7bee7dc501e405a38f5;p=openldap DPRINTF(): Fix format, handle non-gcc, simplify. Add C99-required 1st parameter. Disable for for non-gcc. Simplify. GNU extension #define DPRINTF(...) -> GNU ext ,##__VA_ARGS__. Fix __LINE__ format %ld -> %d. --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 35bb544100..426d6d178b 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -25,14 +25,15 @@ #include "mdb.h" -#define DEBUG +#ifndef DEBUG +#define DEBUG 1 +#endif -#ifdef DEBUG -# define DPRINTF(...) do { fprintf(stderr, "%s:%d: ", __func__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - fprintf(stderr, "\n"); } while(0) +#if (DEBUG +0) && defined(__GNUC__) +# define DPRINTF(fmt, ...) \ + fprintf(stderr, "%s:%d: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__) #else -# define DPRINTF(...) +# define DPRINTF(...) ((void) 0) #endif #define PAGESIZE 4096