Fix: sink.text.pretty: comma in enum fields
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 27 May 2019 18:50:19 +0000 (14:50 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 5 Jun 2019 17:47:34 +0000 (13:47 -0400)
The condition for printing commas that separate labels of enum fields is
reversed.  It causes a comma tu be spuriously printed before the first
label:

  enumfield = ( , "zero" : container = 0 )

instead of:

  enumfield = ( "zero" : container = 0 )

With multiple matching labels, before:

  enumfield = ( , "zero""one" : container = 0 )

and after:

  enumfield = ( "zero", "one" : container = 0

Change-Id: I03452b8ece4f97bf0c819f6885ef512f7ddc31e6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1334
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/text/pretty/print.c

index efcf2b885d3d6523f52218e3e86fec0226f12de1..a3f94b96fd140ffbcd9cfb8045f3c00d32c83986 100644 (file)
@@ -717,7 +717,7 @@ int print_enum(struct pretty_component *pretty,
        for (i = 0; i < label_count; i++) {
                const char *mapping_name = label_array[i];
 
-               if (i == 0) {
+               if (i != 0) {
                        g_string_append(pretty->string, ", ");
                }
                if (pretty->use_colors) {
This page took 0.025007 seconds and 4 git commands to generate.