]> granicus.if.org Git - sysstat/commitdiff
Move format specific code to its corresponding function
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 22 Jan 2016 12:57:42 +0000 (13:57 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 22 Jan 2016 12:57:42 +0000 (13:57 +0100)
Incrementing tab variable was specific to XML output. So move this code
to the f_timestamp function used by XML output format, so that thee main
code remains generic.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sadf.c
sadf_misc.c

diff --git a/sadf.c b/sadf.c
index 9020758e8d9226d15acaeb9cc9bb18dcdcba43b8..b8182516e7e10f07235e44dd7ae0f40cf1677442 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -649,9 +649,6 @@ int logic1_write_stats(int curr, int use_tm_start, int use_tm_end, int reset,
                                                !PRINT_LOCAL_TIME(flags) &&
                                                !PRINT_TRUE_TIME(flags), dt);
        }
-       if (format == F_XML_OUTPUT) {
-               tab++;
-       }
 
        /* Display statistics */
        for (i = 0; i < NR_ACT; i++) {
index 7a5ed166f37e47a6f6ba3a1e0ce9eb80ea794012..8159e2412e6b09959697ecbbba1ddafe1119d283 100644 (file)
@@ -426,7 +426,7 @@ __printf_funct_t print_xml_timestamp(int *tab, int action, char *cur_date,
                                     char *cur_time, int utc, unsigned long long itv)
 {
        if (action & F_BEGIN) {
-               xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
+               xprintf((*tab)++, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\">",
                        cur_date, cur_time, utc ? 1 : 0, itv);
        }
        if (action & F_END) {