Commit db69cead authored by Max Kellermann's avatar Max Kellermann

db/LightSong: make "real_uri" a pointer

Reduce overhead. LightSong can always point to the "real" allocated string.
parent b9c248e7
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
DetachedSong::DetachedSong(const LightSong &other) DetachedSong::DetachedSong(const LightSong &other)
:uri(other.GetURI().c_str()), :uri(other.GetURI().c_str()),
real_uri(other.real_uri), real_uri(other.real_uri != nullptr ? other.real_uri : ""),
tag(*other.tag), tag(*other.tag),
mtime(other.mtime), mtime(other.mtime),
start_ms(other.start_ms), end_ms(other.end_ms) {} start_ms(other.start_ms), end_ms(other.end_ms) {}
......
...@@ -48,13 +48,13 @@ struct LightSong { ...@@ -48,13 +48,13 @@ struct LightSong {
/** /**
* The "real" URI, the one to be used for opening the * The "real" URI, the one to be used for opening the
* resource. If this attribute is empty, then #uri (and * resource. If this attribute is nullptr, then #uri (and
* #directory) shall be used. * #directory) shall be used.
* *
* This attribute is used for songs from the database which * This attribute is used for songs from the database which
* have a relative URI. * have a relative URI.
*/ */
std::string real_uri; const char *real_uri;
/** /**
* Must not be nullptr. * Must not be nullptr.
......
...@@ -102,6 +102,7 @@ Song::Export() const ...@@ -102,6 +102,7 @@ Song::Export() const
dest.directory = parent->IsRoot() dest.directory = parent->IsRoot()
? nullptr : parent->GetPath(); ? nullptr : parent->GetPath();
dest.uri = uri; dest.uri = uri;
dest.real_uri = nullptr;
dest.tag = &tag; dest.tag = &tag;
dest.mtime = mtime; dest.mtime = mtime;
dest.start_ms = start_ms; dest.start_ms = start_ms;
......
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