[PATCH 1/3] Introduce vtprintf function

JingPiao Chen chenjingpiao at gmail.com
Fri Mar 31 11:20:51 UTC 2017


* strace.c (vtprintf): New function.
(tprintf): Use it.
---
 strace.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/strace.c b/strace.c
index 7214e6e..2b50cc0 100644
--- a/strace.c
+++ b/strace.c
@@ -569,12 +569,9 @@ strace_popen(const char *command)
 	return fp;
 }
 
-void
-tprintf(const char *fmt, ...)
+static void
+vtprintf(const char *fmt, va_list args)
 {
-	va_list args;
-
-	va_start(args, fmt);
 	if (current_tcp) {
 		int n = vfprintf(current_tcp->outf, fmt, args);
 		if (n < 0) {
@@ -583,6 +580,15 @@ tprintf(const char *fmt, ...)
 		} else
 			current_tcp->curcol += n;
 	}
+}
+
+void
+tprintf(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vtprintf(fmt, args);
 	va_end(args);
 }
 
-- 
2.7.4





More information about the Strace-devel mailing list