Fix for bug #1091748 (DIG: Starting new games takes a long time); turns out querying the debuglevel from the config-manager very often is too slow

svn-id: r16345
This commit is contained in:
Max Horn 2004-12-27 21:54:20 +00:00
parent 2eb17ef322
commit d138a880bf
6 changed files with 59 additions and 49 deletions

View file

@ -158,50 +158,6 @@ void CDECL warning(const char *s, ...) {
#endif
}
static void debugHelper(char *buf) {
#ifndef _WIN32_WCE
printf("%s\n", buf);
#endif
#if defined( USE_WINDBG )
strcat(buf, "\n");
#if defined( _WIN32_WCE )
TCHAR buf_unicode[1024];
MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode));
OutputDebugString(buf_unicode);
#else
OutputDebugString(buf);
#endif
#endif
fflush(stdout);
}
void CDECL debug(int level, const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
if (level > ConfMan.getInt("debuglevel"))
return;
va_start(va, s);
vsprintf(buf, s, va);
va_end(va);
debugHelper(buf);
}
void CDECL debug(const char *s, ...) {
char buf[STRINGBUFLEN];
va_list va;
va_start(va, s);
vsprintf(buf, s, va);
va_end(va);
debugHelper(buf);
}
void checkHeap() {
#if defined(_MSC_VER)
if (_heapchk() != _HEAPOK) {