diff options
author | Max Kellermann <max@duempel.org> | 2014-01-23 22:18:40 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-23 22:35:22 +0100 |
commit | b8e382b011e524ed4577fbc5b0871f86f1c196d4 (patch) | |
tree | d72bd389c91668dd0f315c0152b5d6abb30fe841 /src/db/upnp/Discovery.hxx | |
parent | c9af358e4bbc39da7dfe3ce650008c12ac3f8335 (diff) | |
download | mpd-b8e382b011e524ed4577fbc5b0871f86f1c196d4.tar.gz mpd-b8e382b011e524ed4577fbc5b0871f86f1c196d4.tar.xz mpd-b8e382b011e524ed4577fbc5b0871f86f1c196d4.zip |
db/upnp/Discovery: use std::list instead of std::map
There will only be very few items, and that does not justify the bloat
of std::map.
Diffstat (limited to '')
-rw-r--r-- | src/db/upnp/Discovery.hxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/db/upnp/Discovery.hxx b/src/db/upnp/Discovery.hxx index fec9fe1fb..4c64fe420 100644 --- a/src/db/upnp/Discovery.hxx +++ b/src/db/upnp/Discovery.hxx @@ -27,7 +27,7 @@ #include <upnp/upnp.h> -#include <map> +#include <list> #include <vector> #include <string> @@ -63,6 +63,8 @@ class UPnPDeviceDirectory { */ class ContentDirectoryDescriptor { public: + std::string id; + UPnPDevice device; /** @@ -73,8 +75,9 @@ class UPnPDeviceDirectory { ContentDirectoryDescriptor() = default; - ContentDirectoryDescriptor(unsigned last, int exp) - :expires(last + exp + 20) {} + ContentDirectoryDescriptor(std::string &&_id, + unsigned last, int exp) + :id(std::move(_id)), expires(last + exp + 20) {} bool Parse(const std::string &url, const char *description, Error &_error) { @@ -85,7 +88,7 @@ class UPnPDeviceDirectory { LibUPnP *const lib; Mutex mutex; - std::map<std::string, ContentDirectoryDescriptor> directories; + std::list<ContentDirectoryDescriptor> directories; WorkQueue<DiscoveredTask *> discoveredQueue; /** @@ -129,7 +132,7 @@ private: */ bool expireDevices(Error &error); - void LockAdd(std::string &&id, ContentDirectoryDescriptor &&d); + void LockAdd(ContentDirectoryDescriptor &&d); void LockRemove(const std::string &id); /** |