From bad035e9a34cd247ca54a4cd4ca75ac2ae6b185b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 11 Sep 2018 21:36:07 -0400 Subject: audio_core/sink_details: Change std::string parameter into std::string_view The given string is only ever used for lookup and comparison, so we can just utilize a non-owning view to string data here --- src/audio_core/sink_details.cpp | 2 +- src/audio_core/sink_details.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink_details.cpp index 955ba20fb..67cf1f3b2 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink_details.cpp @@ -24,7 +24,7 @@ const std::vector g_sink_details = { [] { return std::vector{"null"}; }}, }; -const SinkDetails& GetSinkDetails(std::string sink_id) { +const SinkDetails& GetSinkDetails(std::string_view sink_id) { auto iter = std::find_if(g_sink_details.begin(), g_sink_details.end(), [sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; }); diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h index ea666c554..03534b187 100644 --- a/src/audio_core/sink_details.h +++ b/src/audio_core/sink_details.h @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include @@ -30,6 +32,6 @@ struct SinkDetails { extern const std::vector g_sink_details; -const SinkDetails& GetSinkDetails(std::string sink_id); +const SinkDetails& GetSinkDetails(std::string_view sink_id); } // namespace AudioCore -- cgit v1.2.3