Commit 7260d788 authored by Max Kellermann's avatar Max Kellermann

db/upnp: move "objid" declaration down

Don't allocate the object when it's not needed.
parent 154250f5
...@@ -467,8 +467,6 @@ UpnpDatabase::Namei(ContentDirectoryService &server, ...@@ -467,8 +467,6 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
UPnPDirObject &odirent, UPnPDirObject &odirent,
Error &error) const Error &error) const
{ {
std::string objid(rootid);
if (vpath.empty()) { if (vpath.empty()) {
// looking for root info // looking for root info
if (!ReadNode(server, rootid, odirent, error)) if (!ReadNode(server, rootid, odirent, error))
...@@ -479,6 +477,8 @@ UpnpDatabase::Namei(ContentDirectoryService &server, ...@@ -479,6 +477,8 @@ UpnpDatabase::Namei(ContentDirectoryService &server,
const UpnpClient_Handle handle = m_lib->getclh(); const UpnpClient_Handle handle = m_lib->getclh();
std::string objid(rootid);
// Walk the path elements, read each directory and try to find the next one // Walk the path elements, read each directory and try to find the next one
for (unsigned int i = 0; i < vpath.size(); i++) { for (unsigned int i = 0; i < vpath.size(); i++) {
UPnPDirContent dirbuf; UPnPDirContent dirbuf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment