BT_HIDDEN
bool ctf_fs_debug;
+static
+enum bt_notification_iterator_status ctf_fs_iterator_next(
+ struct bt_notification_iterator *iterator);
+
static
struct bt_notification *ctf_fs_iterator_get(
struct bt_notification_iterator *iterator)
struct ctf_fs_iterator *ctf_it =
bt_notification_iterator_get_private_data(iterator);
+ if (!ctf_it->current_notification) {
+ (void) ctf_fs_iterator_next(iterator);
+ }
+
return bt_get(ctf_it->current_notification);
}
if (ret) {
goto error;
}
+
end:
return ret;
error:
goto end;
}
- if (!text->processed_first_event) {
- ret = bt_notification_iterator_next(it);
- if (ret != BT_COMPONENT_STATUS_OK) {
+ if (likely(text->processed_first_event)) {
+ enum bt_notification_iterator_status it_ret;
+
+ it_ret = bt_notification_iterator_next(it);
+ switch (it_ret) {
+ case BT_NOTIFICATION_ITERATOR_STATUS_ERROR:
+ ret = BT_COMPONENT_STATUS_ERROR;
+ goto end;
+ case BT_NOTIFICATION_ITERATOR_STATUS_END:
+ ret = BT_COMPONENT_STATUS_END;
goto end;
+ default:
+ break;
}
- } else {
- text->processed_first_event = true;
}
-
notification = bt_notification_iterator_get_notification(it);
if (!notification) {
ret = BT_COMPONENT_STATUS_ERROR;
}
ret = handle_notification(text, notification);
+ text->processed_first_event = true;
end:
bt_put(it);
bt_put(notification);
struct text_component {
struct text_options options;
FILE *out, *err;
- bool processed_first_event;
+ bool processed_first_event; /* Should be per-iterator. */
int depth; /* nesting, used for tabulation alignment. */
bool start_line;
GString *string;