From 1a67062e1ed31ef8f26a4fe0827417111402947d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 8 Jan 2024 13:51:00 +0100 Subject: [PATCH] db/simple: reorder fields to reduce padding --- src/db/plugins/simple/SimpleDatabasePlugin.cxx | 8 ++++---- src/db/plugins/simple/SimpleDatabasePlugin.hxx | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index be2a7e298..d6d7a2cce 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -42,11 +42,11 @@ static constexpr Domain simple_db_domain("simple_db"); inline SimpleDatabase::SimpleDatabase(const ConfigBlock &block) :Database(simple_db_plugin), path(block.GetPath("path")), + cache_path(block.GetPath("cache_directory")), #ifdef ENABLE_ZLIB compress(block.GetBlockValue("compress", true)), #endif - hide_playlist_targets(block.GetBlockValue("hide_playlist_targets", true)), - cache_path(block.GetPath("cache_directory")) + hide_playlist_targets(block.GetBlockValue("hide_playlist_targets", true)) { if (path.IsNull()) throw std::runtime_error("No \"path\" parameter specified"); @@ -64,11 +64,11 @@ SimpleDatabase::SimpleDatabase(AllocatedPath &&_path, :Database(simple_db_plugin), path(std::move(_path)), path_utf8(path.ToUTF8()), + cache_path(nullptr), #ifdef ENABLE_ZLIB compress(_compress), #endif - hide_playlist_targets(_hide_playlist_targets), - cache_path(nullptr) + hide_playlist_targets(_hide_playlist_targets) { } diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx index 7df59f4bd..5b544251b 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx @@ -24,12 +24,6 @@ class SimpleDatabase : public Database { AllocatedPath path; std::string path_utf8; -#ifdef ENABLE_ZLIB - bool compress; -#endif - - bool hide_playlist_targets; - /** * The path where cache files for Mount() are located. */ @@ -54,6 +48,12 @@ class SimpleDatabase : public Database { mutable unsigned borrowed_song_count; #endif +#ifdef ENABLE_ZLIB + const bool compress; +#endif + + const bool hide_playlist_targets; + public: SimpleDatabase(const ConfigBlock &block); SimpleDatabase(AllocatedPath &&_path, bool _compress,