It disables buffering of strings passed to trace_printf().

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/vm/trace.h |    2 ++
 vm/jato.c          |    7 +++++++
 vm/trace.c         |    9 ++++++++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/include/vm/trace.h b/include/vm/trace.h
index 79959ea..18bdfca 100644
--- a/include/vm/trace.h
+++ b/include/vm/trace.h
@@ -1,6 +1,8 @@
 #ifndef _VM_TRACE_H
 #define _VM_TRACE_H
 
+extern bool nobuf_enabled;
+
 int trace_printf(const char *fmt, ...);
 void trace_flush(void);
 
diff --git a/vm/jato.c b/vm/jato.c
index 924ee24..83eb82d 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -70,6 +70,7 @@
 #include "vm/string.h"
 #include "vm/system.h"
 #include "vm/thread.h"
+#include "vm/trace.h"
 #include "vm/unsafe.h"
 #include "vm/class.h"
 #include "vm/call.h"
@@ -943,6 +944,11 @@ static void handle_jar(const char *arg)
        classloader_add_to_classpath(arg);
 }
 
+static void handle_nobuf(void)
+{
+       nobuf_enabled = true;
+}
+
 static void handle_perf(void)
 {
        perf_enabled = true;
@@ -1097,6 +1103,7 @@ const struct option options[] = {
        DEFINE_OPTION_ARG("cp",         handle_classpath),
        DEFINE_OPTION_ARG("jar",        handle_jar),
 
+       DEFINE_OPTION("Xnobuf",                 handle_nobuf),
        DEFINE_OPTION("Xperf",                  handle_perf),
 
        DEFINE_OPTION_ARG("Xtrace:method",      handle_trace_method),
diff --git a/vm/trace.c b/vm/trace.c
index 2172b7e..d7f1f6a 100644
--- a/vm/trace.c
+++ b/vm/trace.c
@@ -36,6 +36,8 @@
 #include "vm/thread.h"
 #include "vm/trace.h"
 
+bool nobuf_enabled;
+
 static pthread_mutex_t trace_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static __thread struct string *trace_buffer = NULL;
@@ -58,7 +60,12 @@ int trace_printf(const char *fmt, ...)
        ensure_trace_buffer();
 
        va_start(args, fmt);
-       err = str_vappend(trace_buffer, fmt, args);
+
+       if (nobuf_enabled)
+               err = vprintf(fmt, args);
+       else
+               err = str_vappend(trace_buffer, fmt, args);
+
        va_end(args);
        return err;
 }
-- 
1.6.3.3


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to