From 3a58e9dea32937308577c6f8bd8b2b6ea3bd5092 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 2 Feb 2018 13:40:55 +0000 Subject: Add a simple debug logging mechanism. --- calmwm.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'calmwm.h') diff --git a/calmwm.h b/calmwm.h index c9fd91d..ccb0736 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.354 2018/02/02 13:27:25 okan Exp $ + * $OpenBSD: calmwm.h,v 1.355 2018/02/02 13:40:55 okan Exp $ */ #ifndef _CALMWM_H_ @@ -31,6 +31,13 @@ #include #include +/* #define DEBUG */ +#ifdef DEBUG +#define DPRINTF(...) log_debug(__func__, __VA_ARGS__) +#else +#define DPRINTF(...) do {} while (0) +#endif /* DEBUG */ + #undef MIN #undef MAX #define MIN(x, y) ((x) < (y) ? (x) : (y)) @@ -584,6 +591,9 @@ void xu_ewmh_restore_net_wm_state(struct client_ctx *); char *u_argv(char * const *); void u_exec(char *); void u_spawn(char *); +void log_debug(const char *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))) + __attribute__((__nonnull__ (2))); void *xcalloc(size_t, size_t); void *xmalloc(size_t); -- cgit v1.2.3-2-gb3c3