sink.text.pretty: remove error checks for bt_field_borrow_class_const results
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 2 Mar 2020 19:18:30 +0000 (14:18 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 6 Mar 2020 18:36:39 +0000 (13:36 -0500)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3155
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/text/pretty/print.c

index 92258030bc79f5dae24009eba88c3f6d3c8e3ac5..e908d75db9f074f635192136281857cbf950c5bf 100644 (file)
@@ -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++;
This page took 0.02697 seconds and 4 git commands to generate.