From 5465d661de4d0de2b1def36c9149d55f77e460cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20K=C3=BCthe?= Date: Fri, 14 Feb 2025 23:14:24 +0000 Subject: [PATCH] xml report: remove leading spaces --- ui/report.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ui/report.c b/ui/report.c index 61f2c74..364a9be 100644 --- a/ui/report.c +++ b/ui/report.c @@ -406,6 +406,7 @@ void xml_close( int i, j, at, max; ip_t *addr; char name[MAX_FORMAT_STR]; + char buf[128]; printf("\n"); printf("LocalHostname, @@ -438,9 +439,6 @@ void xml_close( if (j <= 0) continue; /* Field nr 0, " " shouldn't be printed in this method. */ - snprintf(name, sizeof(name), "%s%s%s", " <%s>", - data_fields[j].format, "\n"); - /* XML doesn't allow "%" in tag names, rename Loss% to just Loss */ title = data_fields[j].title; if (strcmp(data_fields[j].title, "Loss%") == 0) { @@ -449,11 +447,12 @@ void xml_close( /* 1000.0 is a temporary hack for stats usec to ms, impacted net_loss. */ if (strchr(data_fields[j].format, 'f')) { - printf(name, - title, data_fields[j].net_xxx(at) / 1000.0, title); + snprintf(buf, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at) / 1000.0); } else { - printf(name, title, data_fields[j].net_xxx(at), title); + snprintf(buf, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at)); } + trim(buf, 0); + printf(" <%s>%s\n", title, buf, title); } printf(" \n"); } -- 2.47.2