ofp-print: Use ds_chomp() in ofp10_match_to_string()
authorSimon Horman <simon.horman@netronome.com>
Tue, 4 Nov 2014 06:14:04 +0000 (15:14 +0900)
committerBen Pfaff <blp@nicira.com>
Tue, 4 Nov 2014 16:45:27 +0000 (08:45 -0800)
Slightly simplify ofp10_match_to_string() by using ds_chomp()
rather than open-coding its logic.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-print.c

index 8dc7f06..d27d8a7 100644 (file)
@@ -687,9 +687,7 @@ ofp10_match_to_string(const struct ofp10_match *om, int verbosity)
         print_wild(&f, "tp_dst=", w & OFPFW10_TP_DST, verbosity,
                    "%d", ntohs(om->tp_dst));
     }
-    if (ds_last(&f) == ',') {
-        f.length--;
-    }
+    ds_chomp(&f, ',');
     return ds_cstr(&f);
 }