X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/dc9744f7c6f1aa8f676f84829ee9a69a52952f94..8c296c6278b675036a42df5bf64d9fc29dcac453:/print-openflow-1.0.c?ds=sidebyside diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index d7ac8b24..d1cafc5d 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -697,12 +697,11 @@ static const char * vlan_str(const uint16_t vid) { static char buf[sizeof("65535 (bogus)")]; - const char *fmt; if (vid == OFP_VLAN_NONE) return "NONE"; - fmt = (vid > 0 && vid < 0x0fff) ? "%u" : "%u (bogus)"; - nd_snprintf(buf, sizeof(buf), fmt, vid); + nd_snprintf(buf, sizeof(buf), "%u%s", vid, + (vid > 0 && vid < 0x0fff) ? "" : " (bogus)"); return buf; } @@ -710,7 +709,8 @@ static const char * pcp_str(const uint8_t pcp) { static char buf[sizeof("255 (bogus)")]; - nd_snprintf(buf, sizeof(buf), pcp <= 7 ? "%u" : "%u (bogus)", pcp); + nd_snprintf(buf, sizeof(buf), "%u%s", pcp, + pcp <= 7 ? "" : " (bogus)"); return buf; }