sink.text.pretty: abort on unknown field class type
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 11 Mar 2022 17:03:35 +0000 (12:03 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 28 Mar 2024 17:52:05 +0000 (13:52 -0400)
I don't think there a legimitate case for the print_field function to
encounter an invalid field class type.  Change it to abort instead of
returning an error.

Change-Id: I333d2221b828841aff38a7d8b0a17032af3aafb1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7580
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7573

src/plugins/text/pretty/print.c

index a08235e80cb4219786717fb4bbeb837c43c3070a..4c7e18337b5e459787ad2233080f1b4c8d1eea6a 100644 (file)
@@ -1311,11 +1311,9 @@ int print_field(struct pretty_component *pretty,
        } else if (bt_field_class_type_is(class_id,
                        BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY)) {
                return print_sequence(pretty, field, print_names);
-       } else {
-               // TODO: log instead
-               fprintf(pretty->err, "[error] Unknown type id: %d\n", (int) class_id);
-               return -1;
        }
+
+       bt_common_abort();
 }
 
 static
This page took 0.025712 seconds and 4 git commands to generate.