X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Ftext%2Fpretty%2Fpretty.c;h=1e248644398022c43b59e94173a15235ef0d25f6;hp=a925b7d8fce9b9c9b936ef535b0e007d2b253882;hb=a3f0c7db90f4cfc81090a83a7442b7bc624d5789;hpb=27a1afa74b56f211aa0a44acf268501b73c15aa9 diff --git a/src/plugins/text/pretty/pretty.c b/src/plugins/text/pretty/pretty.c index a925b7d8..1e248644 100644 --- a/src/plugins/text/pretty/pretty.c +++ b/src/plugins/text/pretty/pretty.c @@ -46,12 +46,12 @@ const char * const in_port_name = "in"; static void destroy_pretty_data(struct pretty_component *pretty) { - bt_self_component_port_input_message_iterator_put_ref(pretty->iterator); - if (!pretty) { goto end; } + bt_self_component_port_input_message_iterator_put_ref(pretty->iterator); + if (pretty->string) { (void) g_string_free(pretty->string, TRUE); } @@ -109,25 +109,25 @@ void pretty_finalize(bt_self_component_sink *comp) } static -bt_component_class_message_iterator_next_method_status handle_message( +bt_message_iterator_class_next_method_status handle_message( struct pretty_component *pretty, const bt_message *message) { - bt_component_class_message_iterator_next_method_status ret = - BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK; + bt_message_iterator_class_next_method_status ret = + BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK; - BT_ASSERT(pretty); + BT_ASSERT_DBG(pretty); switch (bt_message_get_type(message)) { case BT_MESSAGE_TYPE_EVENT: if (pretty_print_event(pretty, message)) { - ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR; + ret = BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR; } break; case BT_MESSAGE_TYPE_DISCARDED_EVENTS: case BT_MESSAGE_TYPE_DISCARDED_PACKETS: if (pretty_print_discarded_items(pretty, message)) { - ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR; + ret = BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_ERROR; } break; default: @@ -199,7 +199,7 @@ bt_component_class_sink_consume_method_status pretty_consume( goto end; } - BT_ASSERT(next_status == BT_MESSAGE_ITERATOR_NEXT_STATUS_OK); + BT_ASSERT_DBG(next_status == BT_MESSAGE_ITERATOR_NEXT_STATUS_OK); for (i = 0; i < count; i++) { ret = (int) handle_message(pretty, msgs[i]); @@ -296,6 +296,7 @@ end: static const char *color_choices[] = { "never", "auto", "always", NULL }; static const char *show_hide_choices[] = { "show", "hide", NULL }; +static struct bt_param_validation_map_value_entry_descr pretty_params[] = { { "color", BT_PARAM_VALIDATION_MAP_VALUE_ENTRY_OPTIONAL, { BT_VALUE_TYPE_STRING, .string = { .choices = color_choices, @@ -430,7 +431,7 @@ bt_component_class_initialize_method_status apply_params( pretty->options.print_scope_field_names = false; break; default: - abort(); + bt_common_abort(); } apply_one_bool_if_specified("name-payload", params, @@ -492,7 +493,7 @@ bt_component_class_initialize_method_status apply_params( pretty->options.print_callsite_field = false; break; default: - abort(); + bt_common_abort(); } apply_one_bool_if_specified("field-trace", params, @@ -519,6 +520,7 @@ bt_component_class_initialize_method_status apply_params( apply_one_bool_if_specified("field-callsite", params, &pretty->options.print_callsite_field); + pretty_print_init(); status = BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK; end: