From 54e1d3eecb62f4fd8a6d16abd37fe7c35f47b229 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Jan 2016 18:33:27 +0100 Subject: [PATCH] zapit/debug: remove filename hack with a more elegant one --- configure.ac | 6 ++++++ src/zapit/include/zapit/debug.h | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index c127e9e9f..db4a010c3 100644 --- a/configure.ac +++ b/configure.ac @@ -225,6 +225,12 @@ HWLIB_CFLAGS='-I$(top_srcdir)/lib/libcoolstream2 -I$(top_srcdir)/src/zapit/inclu fi fi +# hack to define a short filename also for out-of-tree build +if test `dirname $0` = `pwd`; then + HWLIB_CFLAGS="$HWLIB_CFLAGS "'-D__file__=__FILE__' +else + HWLIB_CFLAGS="$HWLIB_CFLAGS "'-D__file__="\"$(subst $(srcdir)/,,$(abspath $<))\""' +fi # # Check for libtdservicedb - the new one - for testing only # diff --git a/src/zapit/include/zapit/debug.h b/src/zapit/include/zapit/debug.h index bc40cdfe0..f36d74415 100644 --- a/src/zapit/include/zapit/debug.h +++ b/src/zapit/include/zapit/debug.h @@ -2,6 +2,7 @@ * $Id: debug.h,v 1.7 2003/04/30 04:39:03 obi Exp $ * * (C) 2002-2003 Andreas Oberritter + * (C) 2011,2013,2016 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,14 +49,14 @@ extern int zapit_debug; do { \ if (zapit_debug) \ fprintf(stdout, "[%s:%s:%d] " fmt, \ - __FILE__, __FUNCTION__, \ + __file__, __func__, \ __LINE__ , ## args); \ } while (0) #define ERROR(str) \ do { \ fprintf(stderr, "[%s:%s:%d] %s: %s\n", \ - __FILE__, __FUNCTION__, \ + __file__, __func__, \ __LINE__, str, strerror(errno)); \ } while (0) @@ -64,14 +65,14 @@ extern int zapit_debug; #define INFO(fmt, args...) \ do { \ fprintf(stdout, "[%s:%s:%d] " fmt "\n", \ - __FILE__, __FUNCTION__, \ + __file__, __func__, \ __LINE__ , ## args); \ } while (0) #define WARN(fmt, args...) \ do { \ fprintf(stderr, "[%s:%s:%d] " fmt "\n", \ - __FILE__, __FUNCTION__, \ + __file__, __func__, \ __LINE__ , ## args); \ } while (0)