match: Use ds_chomp() in match_format()
authorSimon Horman <simon.horman@netronome.com>
Tue, 4 Nov 2014 06:13:45 +0000 (15:13 +0900)
committerBen Pfaff <blp@nicira.com>
Tue, 4 Nov 2014 16:43:09 +0000 (08:43 -0800)
Slightly simplify match_format() 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/match.c

index cbfd735..bd3b13d 100644 (file)
@@ -1114,8 +1114,8 @@ match_format(const struct match *match, struct ds *s, int priority)
         }
     }
 
-    if (s->length > start_len && ds_last(s) == ',') {
-        s->length--;
+    if (s->length > start_len) {
+        ds_chomp(s, ',');
     }
 }