From 1ccca665267b4bae923e6435496ed380bd080db5 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 2 Mar 2020 14:18:30 -0500 Subject: [PATCH] sink.text.pretty: remove error checks for bt_field_borrow_class_const results bt_field_borrow_class_const can't fail, so these error checks are unnecessary. Removing them reveals that some of these variables were in fact unused, so remove them. Change-Id: I57867e0eb01db3bd7c73dfedc9d1772cbfad02d5 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/3155 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/text/pretty/print.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/plugins/text/pretty/print.c b/src/plugins/text/pretty/print.c index 92258030..e908d75d 100644 --- a/src/plugins/text/pretty/print.c +++ b/src/plugins/text/pretty/print.c @@ -687,17 +687,10 @@ int print_enum(struct pretty_component *pretty, const bt_field *field) { int ret = 0; - const bt_field_class *enumeration_field_class = NULL; bt_field_class_enumeration_mapping_label_array label_array; uint64_t label_count; uint64_t i; - enumeration_field_class = bt_field_borrow_class_const(field); - if (!enumeration_field_class) { - ret = -1; - goto end; - } - switch (bt_field_get_class_type(field)) { case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION: ret = bt_field_enumeration_unsigned_get_mapping_labels(field, @@ -797,11 +790,6 @@ int print_struct(struct pretty_component *pretty, uint64_t nr_fields, i, nr_printed_fields; struct_class = bt_field_borrow_class_const(_struct); - if (!struct_class) { - ret = -1; - goto end; - } - nr_fields = bt_field_class_structure_get_member_count(struct_class); bt_common_g_string_append(pretty->string, "{"); @@ -846,15 +834,9 @@ int print_array(struct pretty_component *pretty, const bt_field *array, bool print_names) { int ret = 0; - const bt_field_class *array_class = NULL; uint64_t len; uint64_t i; - array_class = bt_field_borrow_class_const(array); - if (!array_class) { - ret = -1; - goto end; - } len = bt_field_array_get_length(array); bt_common_g_string_append(pretty->string, "["); pretty->depth++; -- 2.34.1