]> granicus.if.org Git - libnl/commitdiff
route/tc: use plain format string in rtnl_tc_dump_stats()
authorThomas Haller <thaller@redhat.com>
Fri, 14 Aug 2015 13:17:30 +0000 (15:17 +0200)
committerThomas Haller <thaller@redhat.com>
Fri, 14 Aug 2015 13:19:07 +0000 (15:19 +0200)
Signed-off-by: Thomas Haller <thaller@redhat.com>
lib/route/tc.c

index ed82eb996cfed1ac2ea3855d7cc469e49f81ab1b..35daf15ae57d17c5732e5c4d48445d5e9032aec9 100644 (file)
@@ -903,19 +903,20 @@ void rtnl_tc_dump_details(struct nl_object *obj, struct nl_dump_params *p)
 void rtnl_tc_dump_stats(struct nl_object *obj, struct nl_dump_params *p)
 {
        struct rtnl_tc *tc = TC_CAST(obj);
-       char *unit, fmt[64];
+       char *unit;
        float res;
 
        rtnl_tc_dump_details(OBJ_CAST(tc), p);
 
-       strcpy(fmt, "       %10.2f %3s   %10u   %-10u %-10u %-10u %-10u\n");
-
-       nl_dump_line(p, "  stats: %-14s %-10s   %-10s %-10s %-10s %-10s\n",
+       nl_dump_line(p,
+                    "  stats: %-14s %-10s   %-10s %-10s %-10s %-10s\n",
                     "bytes", "packets", "drops", "overlimits", "qlen", "backlog");
 
        res = nl_cancel_down_bytes(tc->tc_stats[RTNL_TC_BYTES], &unit);
 
-       nl_dump_line(p, fmt, res, unit,
+       nl_dump_line(p,
+                    "       %10.2f %3s   %10u   %-10u %-10u %-10u %-10u\n",
+                    res, unit,
                     tc->tc_stats[RTNL_TC_PACKETS],
                     tc->tc_stats[RTNL_TC_DROPS],
                     tc->tc_stats[RTNL_TC_OVERLIMITS],
@@ -924,9 +925,11 @@ void rtnl_tc_dump_stats(struct nl_object *obj, struct nl_dump_params *p)
 
        res = nl_cancel_down_bytes(tc->tc_stats[RTNL_TC_RATE_BPS], &unit);
 
-       strcpy(fmt, "       %10.2f %3s/s %10u/s\n");
-
-       nl_dump_line(p, fmt, res, unit, tc->tc_stats[RTNL_TC_RATE_PPS]);
+       nl_dump_line(p,
+                    "       %10.2f %3s/s %10u/s\n",
+                    res,
+                    unit,
+                    tc->tc_stats[RTNL_TC_RATE_PPS]);
 }
 
 int rtnl_tc_compare(struct nl_object *aobj, struct nl_object *bobj,