aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2006-01-29 02:44:30 +0000
committerEugene Sandulenko2006-01-29 02:44:30 +0000
commit052a42f89fe86fa51bd4c11736f4056fbb3e801e (patch)
treed9044f46dded6743a9936090211d834f569c100b
parent011d75621d16515a99c3c39a675338e19cd7da85 (diff)
downloadscummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.tar.gz
scummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.tar.bz2
scummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.zip
Added new debugN() function which doesn't append newline.
svn-id: r20285
-rw-r--r--base/main.cpp22
-rw-r--r--common/util.h1
2 files changed, 20 insertions, 3 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 84b26599af..6c67fbe013 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -489,13 +489,15 @@ 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
- printf("%s\n", buf);
+ if (caret)
+ printf("%s\n", buf);
#endif
#if defined( USE_WINDBG )
- strcat(buf, "\n");
+ if (caret)
+ strcat(buf, "\n");
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
@@ -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;
diff --git a/common/util.h b/common/util.h
index 05c1520513..cd97363376 100644
--- a/common/util.h
+++ b/common/util.h
@@ -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;