lib

morphux C utility library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/lib

commit 0b2c33fbb46ab05108f7dd0fb704204cb70bc36b
parent 7fa89ea6e764d58e86c9e1f3017fac0fde5bffba
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 24 Apr 2017 19:11:27 +0200

Add(Print): Add m_debug function, only printing on debug mode

Diffstat:
Minc/m_print.h | 7+++++++
Msrc/m_print.c | 15+++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/inc/m_print.h b/inc/m_print.h @@ -77,6 +77,13 @@ void m_warning(const char *str, ...); void m_info(const char *str, ...); /*! + * \brief Print a string on standard output + * \note Support printf format + * \note Only printing when compiled in debug mode, with the DEBUG define + */ +void m_debug(const char *str, ...); + +/*! * \brief Write a string in an already opened log file * \return true on success, false on failure * \note Support printf format diff --git a/src/m_print.c b/src/m_print.c @@ -135,6 +135,21 @@ void m_info(const char *str, ...) { va_end(ap); } +void m_debug(const char *str, ...) { +#ifdef DEBUG + va_list ap; + + va_start(ap, str); + vprintf(str, ap); + fflush(stdout); + va_end(ap); +#else + (void)str; + return ; +#endif + +} + bool m_log(const char *str, ...) { va_list ap; bool ret;