[PATCH 18/38] trace-cmd lib: remove useless code in tracecmd_plog()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In __plog(), both branch of the "if (newline)" statement are
identical. I guess the original intent was to print a newline if the
last message didn't end in one. But it seems that all messages send to
tracecmd_plog() terminates with a newline and are short enough to not
get truncated.

Remove all newline code that doesn't do anything.

Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx>
---
 lib/trace-cmd/trace-util.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c
index 47ca3db1..a4334a98 100644
--- a/lib/trace-cmd/trace-util.c
+++ b/lib/trace-cmd/trace-util.c
@@ -453,7 +453,6 @@ void __weak tracecmd_debug(const char *fmt, ...)
 #define LOG_BUF_SIZE 1024
 static void __plog(const char *prefix, const char *fmt, va_list ap, FILE *fp)
 {
-	static int newline = 1;
 	char buf[LOG_BUF_SIZE];
 	int r;
 
@@ -463,11 +462,7 @@ static void __plog(const char *prefix, const char *fmt, va_list ap, FILE *fp)
 		r = LOG_BUF_SIZE;
 
 	if (logfp) {
-		if (newline)
-			fprintf(logfp, "[%d]%s%.*s", getpid(), prefix, r, buf);
-		else
-			fprintf(logfp, "[%d]%s%.*s", getpid(), prefix, r, buf);
-		newline = buf[r - 1] == '\n';
+		fprintf(logfp, "[%d]%s%.*s", getpid(), prefix, r, buf);
 		fflush(logfp);
 		return;
 	}
-- 
2.44.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux