diff options
author | Max Kellermann <max@duempel.org> | 2014-02-04 00:38:52 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-04 00:38:52 +0100 |
commit | db69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9 (patch) | |
tree | bc949afdd343c881993e2faf9003ac1b171fdab0 /src | |
parent | b9c248e7e7a451aa8aa2718323abd02a73d3dab5 (diff) | |
download | mpd-db69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9.tar.gz mpd-db69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9.tar.xz mpd-db69ceade64c1e1a9c3d7a7c634f8b8b05ce73b9.zip |
db/LightSong: make "real_uri" a pointer
Reduce overhead. LightSong can always point to the "real" allocated
string.
Diffstat (limited to 'src')
-rw-r--r-- | src/DetachedSong.cxx | 2 | ||||
-rw-r--r-- | src/db/LightSong.hxx | 4 | ||||
-rw-r--r-- | src/db/Song.cxx | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx index 2fff9b70f..eb377e591 100644 --- a/src/DetachedSong.cxx +++ b/src/DetachedSong.cxx @@ -25,7 +25,7 @@ DetachedSong::DetachedSong(const LightSong &other) :uri(other.GetURI().c_str()), - real_uri(other.real_uri), + real_uri(other.real_uri != nullptr ? other.real_uri : ""), tag(*other.tag), mtime(other.mtime), start_ms(other.start_ms), end_ms(other.end_ms) {} diff --git a/src/db/LightSong.hxx b/src/db/LightSong.hxx index c0cd47749..add9da855 100644 --- a/src/db/LightSong.hxx +++ b/src/db/LightSong.hxx @@ -48,13 +48,13 @@ struct LightSong { /** * 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. * * This attribute is used for songs from the database which * have a relative URI. */ - std::string real_uri; + const char *real_uri; /** * Must not be nullptr. diff --git a/src/db/Song.cxx b/src/db/Song.cxx index 15924a40a..1c3fa0b64 100644 --- a/src/db/Song.cxx +++ b/src/db/Song.cxx @@ -102,6 +102,7 @@ Song::Export() const dest.directory = parent->IsRoot() ? nullptr : parent->GetPath(); dest.uri = uri; + dest.real_uri = nullptr; dest.tag = &tag; dest.mtime = mtime; dest.start_ms = start_ms; |