Enlarged buffer for _sPrintf() from 256 to 1024 bytes per call.

Minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12118 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-03-29 15:31:09 +00:00
parent f235790dbe
commit 7ffc4e7782
+18 -19
View File
@@ -1,11 +1,12 @@
/* /*
** Copyright 2002-2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2002-2005, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
#include <debugger.h> #include <debugger.h>
#include <OS.h> #include <OS.h>
#include <Debug.h>
#include "syscalls.h" #include "syscalls.h"
#include <stdio.h> #include <stdio.h>
@@ -104,6 +105,7 @@ debug_thread(thread_id thread)
* their debugged teams via fork() and want the child to wait till they have * their debugged teams via fork() and want the child to wait till they have
* installed themselves as team debugger before continuing with exec*(). * installed themselves as team debugger before continuing with exec*().
*/ */
void void
wait_for_debugger(void) wait_for_debugger(void)
{ {
@@ -139,6 +141,7 @@ get_debug_message_string(debug_debugger_message message, char *buffer,
(uint32)message, buffer, bufferSize); (uint32)message, buffer, bufferSize);
} }
void void
get_debug_exception_string(debug_exception_type exception, char *buffer, get_debug_exception_string(debug_exception_type exception, char *buffer,
int32 bufferSize) int32 bufferSize)
@@ -148,11 +151,12 @@ get_debug_exception_string(debug_exception_type exception, char *buffer,
} }
// relating to Debug.h // #pragma mark -
// TODO: verify these functions // Debug.h functions
// TODO: add implementations for printfs
// TODO: verify these functions
// TODO: add implementations for printfs?
#include <Debug.h>
bool _rtDebugFlag = false; bool _rtDebugFlag = false;
@@ -178,8 +182,6 @@ _debugPrintf(const char *fmt, ...)
va_list ap; va_list ap;
int ret; int ret;
// TODO : we need locking here
va_start(ap, fmt); va_start(ap, fmt);
ret = vfprintf(stdout, fmt, ap); ret = vfprintf(stdout, fmt, ap);
va_end(ap); va_end(ap);
@@ -191,22 +193,18 @@ _debugPrintf(const char *fmt, ...)
int int
_sPrintf(const char *fmt, ...) _sPrintf(const char *fmt, ...)
{ {
char buffer[1024];
va_list ap; va_list ap;
int ret; int ret;
char buffer[256]; // seems to be the size used in R5
// TODO : we need locking here
va_start(ap, fmt); va_start(ap, fmt);
ret = vsnprintf(buffer, 256, fmt, ap); ret = vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap); va_end(ap);
if (ret < 0) if (ret >= 0)
return ret; _kern_debug_output(buffer);
_kern_debug_output(buffer); return ret;
return 0;
} }
@@ -233,6 +231,7 @@ _debuggerAssert(const char * file, int line, char * message)
} }
// TODO: Remove. Temporary debug helper. // TODO: Remove. Temporary debug helper.
// (accidently these are more or less the same as _sPrintf())
void void
debug_printf(const char *format, ...) debug_printf(const char *format, ...)