util/SplitString: convert return value to std::string_view

Eliminates lots of overhead.
This commit is contained in:
Max Kellermann
2020-04-03 16:42:49 +02:00
parent 2c02a04566
commit db93bb996c
8 changed files with 27 additions and 32 deletions

View File

@@ -23,7 +23,7 @@
#include "ixmlwrap.hxx"
#include "util/UriRelative.hxx"
#include "util/RuntimeError.hxx"
#include "util/SplitString.hxx"
#include "util/IterableSplitString.hxx"
#include <upnptools.h>
@@ -73,5 +73,8 @@ ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
understand that */
return std::forward_list<std::string>();
return SplitString(s, ',', false);
std::forward_list<std::string> result;
for (const auto &i : IterableSplitString(s, ','))
result.emplace_front(i);
return result;
}

View File

@@ -325,7 +325,7 @@ UPnPDeviceDirectory::GetDirectories()
}
ContentDirectoryService
UPnPDeviceDirectory::GetServer(const char *friendly_name)
UPnPDeviceDirectory::GetServer(std::string_view friendly_name)
{
const std::lock_guard<Mutex> protect(mutex);

View File

@@ -176,7 +176,7 @@ public:
/**
* Get server by friendly name.
*/
ContentDirectoryService GetServer(const char *friendly_name);
ContentDirectoryService GetServer(std::string_view friendly_name);
private:
void Search();