Added new debugN() function which doesn't append newline.

svn-id: r20285
This commit is contained in:
Eugene Sandulenko 2006-01-29 02:44:30 +00:00
parent 011d75621d
commit 052a42f89f
2 changed files with 20 additions and 3 deletions

View File

@ -489,12 +489,14 @@ extern "C" int main(int argc, char *argv[]) {
END_OF_MAIN();
#endif
static void debugHelper(char *buf) {
static void debugHelper(char *buf, bool caret = true) {
#ifndef _WIN32_WCE
if (caret)
printf("%s\n", buf);
#endif
#if defined( USE_WINDBG )
if (caret)
strcat(buf, "\n");
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
@ -522,6 +524,20 @@ void CDECL debug(int level, const char *s, ...) {
debugHelper(buf);
}
void CDECL debugN(int level, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
if (level > gDebugLevel)
return;
va_start(va, s);
vsnprintf(buf, STRINGBUFLEN, s, va);
va_end(va);
debugHelper(buf, false);
}
void CDECL debug(const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;

View File

@ -209,6 +209,7 @@ void CDECL warning(const char *s, ...);
void CDECL debug(int level, const char *s, ...);
void CDECL debug(const char *s, ...);
void CDECL debugN(int level, const char *s, ...);
void checkHeap();
extern int gDebugLevel;