From b5503037f0263f0dd4433973df0a00a78a4334b0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 8 Aug 2010 14:00:09 +0200 Subject: [PATCH] libtriple: add lt_debug() for controllable debug output --- libtriple/Makefile.am | 1 + libtriple/lt_debug.cpp | 18 ++++++++++++++++++ libtriple/lt_debug.h | 4 ++++ 3 files changed, 23 insertions(+) create mode 100644 libtriple/lt_debug.cpp create mode 100644 libtriple/lt_debug.h diff --git a/libtriple/Makefile.am b/libtriple/Makefile.am index ee7d2b6..5d98bf2 100644 --- a/libtriple/Makefile.am +++ b/libtriple/Makefile.am @@ -11,6 +11,7 @@ noinst_LIBRARIES = libtriple.a AM_CPPFLAGS = -fno-rtti -fno-exceptions libtriple_a_SOURCES = \ + lt_debug.cpp \ dmx_td.cpp \ video_td.cpp \ audio_td.cpp \ diff --git a/libtriple/lt_debug.cpp b/libtriple/lt_debug.cpp new file mode 100644 index 0000000..38a424e --- /dev/null +++ b/libtriple/lt_debug.cpp @@ -0,0 +1,18 @@ +/* libtriple debug functions */ + +#include +#include + +int cnxt_debug = 0; + +void lt_debug(const char *fmt, ...) +{ + if (! cnxt_debug) + return; + + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); +} + diff --git a/libtriple/lt_debug.h b/libtriple/lt_debug.h new file mode 100644 index 0000000..90340ed --- /dev/null +++ b/libtriple/lt_debug.h @@ -0,0 +1,4 @@ +#ifndef __LT_DEBUG_H +#define __LT_DEBUG_H +void lt_debug(const char *fmt, ...); +#endif