aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/UpnpDatabasePlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-21 22:46:47 +0100
committerMax Kellermann <max@duempel.org>2014-01-21 23:33:28 +0100
commit54348561362f23b709c04d3e5deac9694698d784 (patch)
treeafcbd4eb71a48b5fd129d9f704794ed8445169ed /src/db/UpnpDatabasePlugin.cxx
parentaa1eb2f40dc7fdef6490634ab82c6f0f82ccfd79 (diff)
downloadmpd-54348561362f23b709c04d3e5deac9694698d784.tar.gz
mpd-54348561362f23b709c04d3e5deac9694698d784.tar.xz
mpd-54348561362f23b709c04d3e5deac9694698d784.zip
db/upnp: use std::list instead of std::vector
Reduce overhead.
Diffstat (limited to 'src/db/UpnpDatabasePlugin.cxx')
-rw-r--r--src/db/UpnpDatabasePlugin.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx
index 7e2bfb2f6..3b9615295 100644
--- a/src/db/UpnpDatabasePlugin.cxx
+++ b/src/db/UpnpDatabasePlugin.cxx
@@ -105,7 +105,7 @@ protected:
private:
bool VisitServer(ContentDirectoryService &server,
- const std::vector<std::string> &vpath,
+ const std::list<std::string> &vpath,
const DatabaseSelection &selection,
VisitDirectory visit_directory,
VisitSong visit_song,
@@ -129,7 +129,7 @@ private:
Error &error) const;
bool Namei(ContentDirectoryService &server,
- const std::vector<std::string> &vpath,
+ const std::list<std::string> &vpath,
UPnPDirObject &dirent,
Error &error) const;
@@ -229,7 +229,8 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
if (!m_superdir->getServer(vpath.front().c_str(), server, error))
return nullptr;
- vpath.erase(vpath.begin());
+ vpath.pop_front();
+
UPnPDirObject dirent;
if (vpath.front() != rootid) {
if (!Namei(server, vpath, dirent, error))
@@ -463,7 +464,7 @@ UpnpDatabase::BuildPath(ContentDirectoryService &server,
// Take server and internal title pathname and return objid and metadata.
bool
UpnpDatabase::Namei(ContentDirectoryService &server,
- const std::vector<std::string> &vpath,
+ const std::list<std::string> &vpath,
UPnPDirObject &odirent,
Error &error) const
{
@@ -528,7 +529,7 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
// really just one path parameter.
bool
UpnpDatabase::VisitServer(ContentDirectoryService &server,
- const std::vector<std::string> &vpath,
+ const std::list<std::string> &vpath,
const DatabaseSelection &selection,
VisitDirectory visit_directory,
VisitSong visit_song,
@@ -706,7 +707,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
// We do have a path: the first element selects the server
std::string servername(std::move(vpath.front()));
- vpath.erase(vpath.begin());
+ vpath.pop_front();
ContentDirectoryService server;
if (!m_superdir->getServer(servername.c_str(), server, error))