]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: literal constant format string for termtable
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 26 Jan 2023 13:23:50 +0000 (14:23 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 27 Jan 2023 11:01:20 +0000 (12:01 +0100)
While this wasn't a problematic use of a format string, make it a
literal constant so the compiler is happy.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/termtable.c

index 91ec753005c6366f0640ba5506b5c8038a640e19..14362e1443ad80b904ce1395fa415859b05d4096 100644 (file)
@@ -436,13 +436,12 @@ char *ttable_dump(struct ttable *tt, const char *newline)
                                abspad -= row[j].style.border.right_on ? 1 : 0;
 
                        /* print text */
-                       const char *fmt;
                        if (row[j].style.align == LEFT)
-                               fmt = "%-*s";
+                               pos += sprintf(&buf[pos], "%-*s", abspad,
+                                              row[j].text);
                        else
-                               fmt = "%*s";
-
-                       pos += sprintf(&buf[pos], fmt, abspad, row[j].text);
+                               pos += sprintf(&buf[pos], "%*s", abspad,
+                                              row[j].text);
 
                        /* print right padding */
                        for (int k = 0; k < row[j].style.rpad; k++)