From 39a7faa46540320fde92c3a5fd7e3cd16060281f Mon Sep 17 00:00:00 2001 From: blankie Date: Tue, 28 Mar 2023 19:55:44 +0700 Subject: [PATCH] Use std::get_if --- event_loop.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/event_loop.cpp b/event_loop.cpp index 18d9518..c527df4 100644 --- a/event_loop.cpp +++ b/event_loop.cpp @@ -17,10 +17,10 @@ static inline void check_for_logcat_items(LogcatThread& logcat_thread, const Con LogcatThreadItem* logcat_thread_item; while ((logcat_thread_item = logcat_thread.atomic_ring_buffer.get())) { - if (std::holds_alternative(*logcat_thread_item)) { - log(std::move(std::get(*logcat_thread_item)), false); - } else if (std::holds_alternative(*logcat_thread_item)) { - logcat_entries.push_back(std::move(std::get(*logcat_thread_item))); + if (LogEntry* log_entry = std::get_if(logcat_thread_item)) { + log(std::move(*log_entry), false); + } else if (LogcatEntry* logcat_entry = std::get_if(logcat_thread_item)) { + logcat_entries.push_back(std::move(*logcat_entry)); if (matches(logcat_entries.back(), active_config.filters, active_config.exclusions)) { filtered_logcat_entry_offsets.push_back(logcat_entries.size() - 1); }