Skip to content

Commit

Permalink
move-only: Move settings to the common library
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheCharlatan committed May 30, 2023
1 parent c2dae5d commit c27e4bd
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/Makefile.am
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.cpp
Expand Up @@ -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>
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/common/args.cpp
Expand Up @@ -6,6 +6,7 @@
#include <common/args.h>

#include <chainparamsbase.h>
#include <common/settings.h>
#include <logging.h>
#include <sync.h>
#include <tinyformat.h>
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/common/args.h
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/common/config.cpp
Expand Up @@ -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>
Expand Down
7 changes: 5 additions & 2 deletions src/util/settings.cpp → src/common/settings.cpp
Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions src/util/settings.h → src/common/settings.h
Expand Up @@ -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>
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/interfaces/chain.h
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/node.h
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/qt/test/optiontests.h
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion src/test/fuzz/string.cpp
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/test/getarg_tests.cpp
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/test/settings_tests.cpp
Expand Up @@ -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>
Expand Down

0 comments on commit c27e4bd

Please sign in to comment.