db/simple: reorder fields to reduce padding

This commit is contained in:
Max Kellermann 2024-01-08 13:51:00 +01:00
parent fec1a4ac32
commit 1a67062e1e
2 changed files with 10 additions and 10 deletions

View File

@ -42,11 +42,11 @@ static constexpr Domain simple_db_domain("simple_db");
inline SimpleDatabase::SimpleDatabase(const ConfigBlock &block) inline SimpleDatabase::SimpleDatabase(const ConfigBlock &block)
:Database(simple_db_plugin), :Database(simple_db_plugin),
path(block.GetPath("path")), path(block.GetPath("path")),
cache_path(block.GetPath("cache_directory")),
#ifdef ENABLE_ZLIB #ifdef ENABLE_ZLIB
compress(block.GetBlockValue("compress", true)), compress(block.GetBlockValue("compress", true)),
#endif #endif
hide_playlist_targets(block.GetBlockValue("hide_playlist_targets", true)), hide_playlist_targets(block.GetBlockValue("hide_playlist_targets", true))
cache_path(block.GetPath("cache_directory"))
{ {
if (path.IsNull()) if (path.IsNull())
throw std::runtime_error("No \"path\" parameter specified"); throw std::runtime_error("No \"path\" parameter specified");
@ -64,11 +64,11 @@ SimpleDatabase::SimpleDatabase(AllocatedPath &&_path,
:Database(simple_db_plugin), :Database(simple_db_plugin),
path(std::move(_path)), path(std::move(_path)),
path_utf8(path.ToUTF8()), path_utf8(path.ToUTF8()),
cache_path(nullptr),
#ifdef ENABLE_ZLIB #ifdef ENABLE_ZLIB
compress(_compress), compress(_compress),
#endif #endif
hide_playlist_targets(_hide_playlist_targets), hide_playlist_targets(_hide_playlist_targets)
cache_path(nullptr)
{ {
} }

View File

@ -24,12 +24,6 @@ class SimpleDatabase : public Database {
AllocatedPath path; AllocatedPath path;
std::string path_utf8; std::string path_utf8;
#ifdef ENABLE_ZLIB
bool compress;
#endif
bool hide_playlist_targets;
/** /**
* The path where cache files for Mount() are located. * The path where cache files for Mount() are located.
*/ */
@ -54,6 +48,12 @@ class SimpleDatabase : public Database {
mutable unsigned borrowed_song_count; mutable unsigned borrowed_song_count;
#endif #endif
#ifdef ENABLE_ZLIB
const bool compress;
#endif
const bool hide_playlist_targets;
public: public:
SimpleDatabase(const ConfigBlock &block); SimpleDatabase(const ConfigBlock &block);
SimpleDatabase(AllocatedPath &&_path, bool _compress, SimpleDatabase(AllocatedPath &&_path, bool _compress,