summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
090eb20)
Replace the switch currently used in details_consume, to convert the
status of bt_message_iterator_next, with a simple cast, as per standard
procedure.
Change-Id: Iea35bd26f4af983d7cca37fc01b2b2f903cc73da
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3394
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bt_component_class_sink_consume_method_status
details_consume(bt_self_component_sink *comp)
{
bt_component_class_sink_consume_method_status
details_consume(bt_self_component_sink *comp)
{
- bt_component_class_sink_consume_method_status ret =
- BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
+ bt_component_class_sink_consume_method_status status;
bt_message_array_const msgs;
uint64_t count;
struct details_comp *details_comp;
bt_message_array_const msgs;
uint64_t count;
struct details_comp *details_comp;
/* Consume messages */
next_status = bt_message_iterator_next(
details_comp->msg_iter, &msgs, &count);
/* Consume messages */
next_status = bt_message_iterator_next(
details_comp->msg_iter, &msgs, &count);
- switch (next_status) {
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
-
- for (i = 0; i < count; i++) {
- int print_ret = details_write_message(details_comp,
- msgs[i]);
-
- if (print_ret) {
- for (; i < count; i++) {
- /* Put all remaining messages */
- bt_message_put_ref(msgs[i]);
- }
+ if (next_status != BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
+ status = (int) next_status;
+ goto end;
+ }
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
- goto end;
- }
+ for (i = 0; i < count; i++) {
+ int print_ret = details_write_message(details_comp,
+ msgs[i]);
- /* Print output buffer to standard output and flush */
- if (details_comp->str->len > 0) {
- printf("%s", details_comp->str->str);
- fflush(stdout);
- details_comp->printed_something = true;
+ if (print_ret) {
+ for (; i < count; i++) {
+ /* Put all remaining messages */
+ bt_message_put_ref(msgs[i]);
- /* Put this message */
- bt_message_put_ref(msgs[i]);
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
+ goto end;
- break;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN:
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN;
- goto end;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END;
- goto end;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR:
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR;
- goto end;
- case BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR:
- ret = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR;
- goto end;
- default:
- bt_common_abort();
+ /* Print output buffer to standard output and flush */
+ if (details_comp->str->len > 0) {
+ printf("%s", details_comp->str->str);
+ fflush(stdout);
+ details_comp->printed_something = true;
+ }
+
+ /* Put this message */
+ bt_message_put_ref(msgs[i]);
+ status = BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
+