From 6813a51fce2fc32d030252d5a64838956245bffd Mon Sep 17 00:00:00 2001 From: trapexit Date: Mon, 17 Nov 2025 17:08:36 -0600 Subject: [PATCH] Ensure cfg references do not also try to initialize the value (#1580) --- src/branches.hpp | 8 ++++++-- src/config.cpp | 27 +++++++++++++-------------- src/tofrom_ref.hpp | 7 ------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/branches.hpp b/src/branches.hpp index 2ed87258..c64e6ec1 100644 --- a/src/branches.hpp +++ b/src/branches.hpp @@ -30,6 +30,9 @@ #include #include +#define MINFREESPACE_DEFAULT (4294967295ULL) + + class Branches final : public ToFromString { public: @@ -64,7 +67,7 @@ public: using Ptr = Branches::Impl::Ptr; public: - u64 minfreespace; + u64 minfreespace = MINFREESPACE_DEFAULT; private: mutable std::mutex _mutex; @@ -73,7 +76,8 @@ private: public: Branches() : _impl(std::make_shared(minfreespace)) - {} + { + } public: int from_string(const std::string_view str) final; diff --git a/src/config.cpp b/src/config.cpp index 091bdd0e..46a2e894 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -37,7 +37,6 @@ #include #include -#define MINFREESPACE_DEFAULT (4294967295ULL) constexpr static const char CACHE_FILES_PROCESS_NAMES_DEFAULT[] = "rtorrent|" @@ -114,20 +113,20 @@ Config::Config() link_cow(false), link_exdev(LinkEXDEV::ENUM::PASSTHROUGH), log_metrics(false), - minfreespace(branches.minfreespace,MINFREESPACE_DEFAULT), + minfreespace(branches.minfreespace), mountpoint(), moveonenospc(true), nfsopenhack(NFSOpenHack::ENUM::OFF), nullrw(false), parallel_direct_writes(true), passthrough_io(PassthroughIO::ENUM::OFF), - passthrough_max_stack_depth(fuse_cfg.passthrough_max_stack_depth,1), - pin_threads(fuse_cfg.pin_threads,"false"), + passthrough_max_stack_depth(fuse_cfg.passthrough_max_stack_depth), + pin_threads(fuse_cfg.pin_threads), posix_acl(false), - process_thread_count(fuse_cfg.process_thread_count,-1), - process_thread_queue_depth(fuse_cfg.process_thread_queue_depth,2), + process_thread_count(fuse_cfg.process_thread_count), + process_thread_queue_depth(fuse_cfg.process_thread_queue_depth), proxy_ioprio(false), - read_thread_count(fuse_cfg.read_thread_count,0), + read_thread_count(fuse_cfg.read_thread_count), readahead(0), readdir("seq"), rename_exdev(RenameEXDEV::ENUM::PASSTHROUGH), @@ -139,20 +138,20 @@ Config::Config() symlinkify_timeout(3600), xattr(XAttr::ENUM::PASSTHROUGH), - _congestion_threshold(fuse_cfg.congestion_threshold,0), - _debug(fuse_cfg.debug,false), - _gid(fuse_cfg.gid,FUSE_CFG_INVALID_ID), - _max_background(fuse_cfg.max_background,0), + _congestion_threshold(fuse_cfg.congestion_threshold), + _debug(fuse_cfg.debug), + _gid(fuse_cfg.gid), + _max_background(fuse_cfg.max_background), _mount(mountpoint), _mountpoint(mountpoint), _never_forget_nodes(), _noforget(), _remember(fuse_cfg.remember_nodes), - _remember_nodes(fuse_cfg.remember_nodes,0), + _remember_nodes(fuse_cfg.remember_nodes), _srcmounts(branches), _threads(fuse_cfg.read_thread_count), - _uid(fuse_cfg.uid,FUSE_CFG_INVALID_ID), - _umask(fuse_cfg.umask,FUSE_CFG_INVALID_UMASK), + _uid(fuse_cfg.uid), + _umask(fuse_cfg.umask), _version(MERGERFS_VERSION), _initialized(false) diff --git a/src/tofrom_ref.hpp b/src/tofrom_ref.hpp index 29e6e956..164fbfb9 100644 --- a/src/tofrom_ref.hpp +++ b/src/tofrom_ref.hpp @@ -27,13 +27,6 @@ public: { } - TFSRef(T &data_, - const T val_) - : _data(data_) - { - _data = val_; - } - private: T &_data; };