Fix win32 define. Change dprintf to function

master
Kirigaya Kazuto 2017-12-16 13:25:31 +08:00
parent cf517691bd
commit 300994d5cb
3 changed files with 22 additions and 12 deletions

View File

@ -1,13 +1,4 @@
#pragma once
#ifdef DEBUG
#ifndef dprintf
/// Debug Output API
#define dprintf(fmt,args...) printf("%s: ",__PRETTY_FUNCTION__);printf(fmt,##args)
#endif /// End of dprintf
#else
#ifndef dprintf
/// Debug Output API
#define dprintf(fmt,args...)
#endif /// End of dprintf
#endif /// End of DEBUG
/// Debug output
void dprintf(const char* fmt,...);

View File

@ -1,6 +1,6 @@
#pragma once
#ifdef __WIN32 /// Windows Needs this Definition.
#ifdef _WIN32 /// Windows Needs this Definition.
#define ZLIB_WINAPI
#endif // __WIN32
#include "zlib/zlib.h"

19
src/log.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "log.h"
#include <cstdarg>
#include <cstdio>
using namespace std;
#ifdef DEBUG
void dprintf(const char* fmt,...)
{
va_list ap;
va_start(ap,fmt);
vprintf(fmt,ap);
va_end(ap);
}
#else
void dprintf(const char* fmt,...)
{
}
#endif