[ovs-dev] [PATCH] ofp-print: Use ds_chomp() in ofp10_match_to_string()

Simon Horman simon.horman at netronome.com
Tue Nov 4 06:14:04 UTC 2014


Slightly simplify ofp10_match_to_string() by using ds_chomp()
rather than open-coding its logic.

Signed-off-by: Simon Horman <simon.horman at netronome.com>
---
 lib/ofp-print.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index 8dc7f06..d27d8a7 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -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);
 }
 
-- 
2.1.1




More information about the dev mailing list