diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-05-24 15:55:53 +0200 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-05-30 17:26:47 +0200 |
commit | c27e4bdc35bc7cedd1ee07e98a52c230241120d1 (patch) | |
tree | 389d47e5c869e1f5252b3ad143ac17bd9efd52d2 /src | |
parent | c2dae5d7d89634fbd771755ce3909719f5462f63 (diff) | |
download | bitcoin-c27e4bdc35bc7cedd1ee07e98a52c230241120d1.tar.xz |
move-only: Move settings to the common library
The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from code that is not strictly required by it.
The settings code belongs into the common library and namespace, since
the kernel library should not depend on it. See doc/design/libraries.md
for more information on this rationale.
Changing the namespace of the moved functions is scripted in the
following commit.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/addrdb.cpp | 2 | ||||
-rw-r--r-- | src/common/args.cpp | 2 | ||||
-rw-r--r-- | src/common/args.h | 2 | ||||
-rw-r--r-- | src/common/config.cpp | 2 | ||||
-rw-r--r-- | src/common/settings.cpp (renamed from src/util/settings.cpp) | 7 | ||||
-rw-r--r-- | src/common/settings.h (renamed from src/util/settings.h) | 7 | ||||
-rw-r--r-- | src/interfaces/chain.h | 2 | ||||
-rw-r--r-- | src/interfaces/node.h | 2 | ||||
-rw-r--r-- | src/qt/test/optiontests.h | 2 | ||||
-rw-r--r-- | src/test/fuzz/string.cpp | 2 | ||||
-rw-r--r-- | src/test/getarg_tests.cpp | 2 | ||||
-rw-r--r-- | src/test/settings_tests.cpp | 2 |
13 files changed, 21 insertions, 17 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 77c36da658..b4ff556eb6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -143,6 +143,7 @@ BITCOIN_CORE_H = \ compat/compat.h \ compat/cpuid.h \ compat/endian.h \ + common/settings.h \ common/system.h \ compressor.h \ consensus/consensus.h \ @@ -309,7 +310,6 @@ BITCOIN_CORE_H = \ util/readwritefile.h \ util/result.h \ util/serfloat.h \ - util/settings.h \ util/sock.h \ util/spanparsing.h \ util/string.h \ @@ -663,6 +663,7 @@ libbitcoin_common_a_SOURCES = \ common/init.cpp \ common/interfaces.cpp \ common/run_command.cpp \ + common/settings.cpp \ common/system.cpp \ compressor.cpp \ core_read.cpp \ @@ -733,7 +734,6 @@ libbitcoin_util_a_SOURCES = \ util/moneystr.cpp \ util/rbf.cpp \ util/readwritefile.cpp \ - util/settings.cpp \ util/thread.cpp \ util/threadinterrupt.cpp \ util/threadnames.cpp \ diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 23f9600ea5..e86fc231a5 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -9,6 +9,7 @@ #include <chainparams.h> #include <clientversion.h> #include <common/args.h> +#include <common/settings.h> #include <cstdint> #include <hash.h> #include <logging.h> @@ -21,7 +22,6 @@ #include <univalue.h> #include <util/fs.h> #include <util/fs_helpers.h> -#include <util/settings.h> #include <util/translation.h> namespace { diff --git a/src/common/args.cpp b/src/common/args.cpp index c9af2d7f5e..289410ecbe 100644 --- a/src/common/args.cpp +++ b/src/common/args.cpp @@ -6,6 +6,7 @@ #include <common/args.h> #include <chainparamsbase.h> +#include <common/settings.h> #include <logging.h> #include <sync.h> #include <tinyformat.h> @@ -14,7 +15,6 @@ #include <util/check.h> #include <util/fs.h> #include <util/fs_helpers.h> -#include <util/settings.h> #include <util/strencodings.h> #ifdef WIN32 diff --git a/src/common/args.h b/src/common/args.h index 7569297a74..c4debb9c82 100644 --- a/src/common/args.h +++ b/src/common/args.h @@ -5,11 +5,11 @@ #ifndef BITCOIN_COMMON_ARGS_H #define BITCOIN_COMMON_ARGS_H +#include <common/settings.h> #include <compat/compat.h> #include <sync.h> #include <util/chaintype.h> #include <util/fs.h> -#include <util/settings.h> #include <iosfwd> #include <list> diff --git a/src/common/config.cpp b/src/common/config.cpp index e25b4fe2df..d156f8e514 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -4,13 +4,13 @@ #include <common/args.h> +#include <common/settings.h> #include <logging.h> #include <sync.h> #include <tinyformat.h> #include <univalue.h> #include <util/chaintype.h> #include <util/fs.h> -#include <util/settings.h> #include <util/string.h> #include <algorithm> diff --git a/src/util/settings.cpp b/src/common/settings.cpp index db3d60046e..7d08355b33 100644 --- a/src/util/settings.cpp +++ b/src/common/settings.cpp @@ -2,15 +2,18 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <util/fs.h> -#include <util/settings.h> +#include <common/settings.h> #include <tinyformat.h> #include <univalue.h> +#include <util/fs.h> +#include <algorithm> #include <fstream> +#include <iterator> #include <map> #include <string> +#include <utility> #include <vector> namespace util { diff --git a/src/util/settings.h b/src/common/settings.h index bb1fe585e1..4cec85ea1e 100644 --- a/src/util/settings.h +++ b/src/common/settings.h @@ -2,11 +2,12 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#ifndef BITCOIN_UTIL_SETTINGS_H -#define BITCOIN_UTIL_SETTINGS_H +#ifndef BITCOIN_COMMON_SETTINGS_H +#define BITCOIN_COMMON_SETTINGS_H #include <util/fs.h> +#include <cstddef> #include <map> #include <string> #include <vector> @@ -111,4 +112,4 @@ auto FindKey(Map&& map, Key&& key) -> decltype(&map.at(key)) } // namespace util -#endif // BITCOIN_UTIL_SETTINGS_H +#endif // BITCOIN_COMMON_SETTINGS_H diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 40bf0b680c..81b444fd33 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -6,8 +6,8 @@ #define BITCOIN_INTERFACES_CHAIN_H #include <blockfilter.h> +#include <common/settings.h> #include <primitives/transaction.h> // For CTransactionRef -#include <util/settings.h> // For util::SettingsValue #include <functional> #include <memory> diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 7e87d5a523..432fa24ee7 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -5,13 +5,13 @@ #ifndef BITCOIN_INTERFACES_NODE_H #define BITCOIN_INTERFACES_NODE_H +#include <common/settings.h> #include <consensus/amount.h> // For CAmount #include <net.h> // For NodeId #include <net_types.h> // For banmap_t #include <netaddress.h> // For Network #include <netbase.h> // For ConnectionDirection #include <support/allocators/secure.h> // For SecureString -#include <util/settings.h> // For util::SettingsValue #include <util/translation.h> #include <functional> diff --git a/src/qt/test/optiontests.h b/src/qt/test/optiontests.h index 0c458c97a6..f8c0f75c34 100644 --- a/src/qt/test/optiontests.h +++ b/src/qt/test/optiontests.h @@ -5,9 +5,9 @@ #ifndef BITCOIN_QT_TEST_OPTIONTESTS_H #define BITCOIN_QT_TEST_OPTIONTESTS_H +#include <common/settings.h> #include <qt/optionsmodel.h> #include <univalue.h> -#include <util/settings.h> #include <QObject> diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp index 75c78ce1bd..52cf546e10 100644 --- a/src/test/fuzz/string.cpp +++ b/src/test/fuzz/string.cpp @@ -5,6 +5,7 @@ #include <blockfilter.h> #include <clientversion.h> #include <common/args.h> +#include <common/settings.h> #include <common/system.h> #include <common/url.h> #include <netbase.h> @@ -22,7 +23,6 @@ #include <test/fuzz/util.h> #include <util/error.h> #include <util/fees.h> -#include <util/settings.h> #include <util/strencodings.h> #include <util/string.h> #include <util/translation.h> diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index 715b6885f5..775d12508a 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -3,10 +3,10 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <common/args.h> +#include <common/settings.h> #include <logging.h> #include <test/util/setup_common.h> #include <univalue.h> -#include <util/settings.h> #include <util/strencodings.h> #include <limits> diff --git a/src/test/settings_tests.cpp b/src/test/settings_tests.cpp index fff84d24f0..2b5f103fc6 100644 --- a/src/test/settings_tests.cpp +++ b/src/test/settings_tests.cpp @@ -2,7 +2,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <util/settings.h> +#include <common/settings.h> #include <test/util/setup_common.h> #include <test/util/str.h> |