From: Nicholas Nethercote Date: Sat, 12 Mar 2005 04:59:51 +0000 (+0000) Subject: Make these vg_message.c functions local, they're no longer used outside the X-Git-Tag: svn/VALGRIND_3_0_0~1031 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e8e7ff197219f73737f2e0a1d60dc0bd638c7bad;p=thirdparty%2Fvalgrind.git Make these vg_message.c functions local, they're no longer used outside the module, as VG_(vmessage)() superseded them. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3287 --- diff --git a/coregrind/vg_messages.c b/coregrind/vg_messages.c index 842c2bfc60..a971324cfe 100644 --- a/coregrind/vg_messages.c +++ b/coregrind/vg_messages.c @@ -64,11 +64,7 @@ static void add_timestamp ( Char *buf ) return; } - -/* Publically visible from here onwards. */ - -int -VG_(add_to_msg) ( const Char *format, ... ) +int add_to_msg ( const Char *format, ... ) { int count; va_list vargs; @@ -78,33 +74,14 @@ VG_(add_to_msg) ( const Char *format, ... ) return count; } -int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs ) -{ - int count; - count = VG_(start_msg) ( kind ); - count += VG_(vprintf) ( add_to_buf, format, vargs, 0 ); - count += VG_(end_msg)(); - return count; -} - -/* Send a simple single-part message. */ -int VG_(message) ( VgMsgKind kind, const Char* format, ... ) -{ - int count; - va_list vargs; - va_start(vargs,format); - count = VG_(vmessage) ( kind, format, vargs ); - va_end(vargs); - return count; -} - -int VG_(start_msg) ( VgMsgKind kind ) +int start_msg ( VgMsgKind kind ) { Char ts[32]; Char c; static const Char pfx[] = ">>>>>>>>>>>>>>>>"; vg_n_mbuf = 0; vg_mbuf[vg_n_mbuf] = 0; + if (VG_(clo_time_stamp)) add_timestamp(ts); else @@ -116,24 +93,44 @@ int VG_(start_msg) ( VgMsgKind kind ) case Vg_ClientMsg: c = '*'; break; default: c = '?'; break; } - return VG_(add_to_msg)( "%s%c%c%s%d%c%c ", - &pfx[sizeof(pfx)-1-RUNNING_ON_VALGRIND], - c,c, ts, VG_(getpid)(), c,c ); + // The pfx trick prints one or more '>' characters in front of the + // messages when running Valgrind under Valgrind, one per level of + // self-hosting. + return add_to_msg( "%s%c%c%s%d%c%c ", + &pfx[sizeof(pfx)-1-RUNNING_ON_VALGRIND], + c,c, ts, VG_(getpid)(), c,c ); } - -int VG_(end_msg) ( void ) +int end_msg ( void ) { int count = 0; if (VG_(clo_log_fd) >= 0) { add_to_buf('\n',0); - VG_(send_bytes_to_logging_sink) ( - vg_mbuf, VG_(strlen)(vg_mbuf) ); + VG_(send_bytes_to_logging_sink) ( vg_mbuf, VG_(strlen)(vg_mbuf) ); count = 1; } return count; } +int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs ) +{ + int count; + count = start_msg ( kind ); + count += VG_(vprintf) ( add_to_buf, format, vargs, 0 ); + count += end_msg(); + return count; +} + +/* Send a simple single-part message. */ +int VG_(message) ( VgMsgKind kind, const Char* format, ... ) +{ + int count; + va_list vargs; + va_start(vargs,format); + count = VG_(vmessage) ( kind, format, vargs ); + va_end(vargs); + return count; +} /* Do the low-level send of a message to the logging sink. */ void VG_(send_bytes_to_logging_sink) ( Char* msg, Int nbytes ) diff --git a/include/tool.h.base b/include/tool.h.base index 506afffe90..f8e5a45a83 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -193,12 +193,6 @@ typedef } VgMsgKind; -/* Functions for building a message from multiple parts. */ -extern int VG_(start_msg) ( VgMsgKind kind ); -extern int VG_(add_to_msg) ( const Char* format, ... ); -/* Ends and prints the message. Appends a newline. */ -extern int VG_(end_msg) ( void ); - /* Send a single-part message. Appends a newline. */ extern int VG_(message) ( VgMsgKind kind, const Char* format, ... ); extern int VG_(vmessage) ( VgMsgKind kind, const Char* format, va_list vargs );