summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-04-20 14:48:59 -0700
committerEric Anholt <eric@anholt.net>2009-04-21 15:25:58 -0700
commitb2d7928f195f6439ecd140e6280b958b8a1f534b (patch)
treed854edf2bbb668a107b794bef0c759693178dc42
parent093f51646b2f2301c907e14d0ad4b1f80ff60a16 (diff)
Use a static inline to replace if (0) to an unused stub function.
-rw-r--r--src/common.h10
-rw-r--r--src/i830_driver.c11
2 files changed, 9 insertions, 12 deletions
diff --git a/src/common.h b/src/common.h
index 8b32a66e..d27d4849 100644
--- a/src/common.h
+++ b/src/common.h
@@ -55,11 +55,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef I830DEBUG
#define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \
__FILE__, __LINE__,__FUNCTION__)
-#define DPRINTF I830DPRINTF_stub
+#define DPRINTF I830DPRINTF
#else /* #ifdef I830DEBUG */
#define MARKER()
-/* this is a real ugly hack to get the compiler to optimize the debugging statements into oblivion */
-#define DPRINTF if(0) I830DPRINTF_stub
+#define DPRINTF I830DPRINTF_stub
+static inline void
+I830DPRINTF_stub(const char *filename, int line, const char *function,
+ const char *fmt, ...)
+{
+}
#endif /* #ifdef I830DEBUG */
#define KB(x) ((x) * 1024)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 26afca5c..905fbeab 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -352,8 +352,8 @@ extern void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
#ifdef I830DEBUG
void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
- const char *fmt, ...)
+I830DPRINTF(const char *filename, int line, const char *function,
+ const char *fmt, ...)
{
va_list ap;
@@ -365,13 +365,6 @@ I830DPRINTF_stub(const char *filename, int line, const char *function,
va_end(ap);
ErrorF("##############################################\n\n");
}
-#else /* #ifdef I830DEBUG */
-void
-I830DPRINTF_stub(const char *filename, int line, const char *function,
- const char *fmt, ...)
-{
- /* do nothing */
-}
#endif /* #ifdef I830DEBUG */
/* Export I830 options to i830 driver where necessary */