*: use transparent comparison for std::{map,set} with std::string keys

This avoids many std::string temporaries for lookups.
This commit is contained in:
Max Kellermann
2023-03-12 09:11:45 +01:00
parent 27d3dcf14c
commit 8b77da545d
23 changed files with 34 additions and 34 deletions

View File

@@ -52,7 +52,7 @@ struct InputPlugin {
/**
* return a set of supported protocols
*/
std::set<std::string> (*protocols)() noexcept;
std::set<std::string, std::less<>> (*protocols)() noexcept;
/**
* Prepare a #RemoteTagScanner. The operation must be started

View File

@@ -589,10 +589,10 @@ input_curl_open(const char *url, Mutex &mutex)
return CurlInputStream::Open(url, {}, mutex);
}
static std::set<std::string>
static std::set<std::string, std::less<>>
input_curl_protocols() noexcept
{
std::set<std::string> protocols;
std::set<std::string, std::less<>> protocols;
auto version_info = curl_version_info(CURLVERSION_FIRST);
for (auto proto_ptr = version_info->protocols; *proto_ptr != nullptr; proto_ptr++) {
if (protocol_is_whitelisted(*proto_ptr)) {

View File

@@ -57,12 +57,12 @@ input_ffmpeg_init(EventLoop &, const ConfigBlock &)
throw PluginUnavailable("No protocol");
}
static std::set<std::string>
static std::set<std::string, std::less<>>
input_ffmpeg_protocols() noexcept
{
void *opaque = nullptr;
const char* protocol;
std::set<std::string> protocols;
std::set<std::string, std::less<>> protocols;
while ((protocol = avio_enum_protocols(&opaque, 0))) {
if (StringIsEqual(protocol, "hls")) {
/* just "hls://" doesn't work, but these do