diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2023-03-06 22:01:13 +0100 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-03-13 17:09:54 +0100 |
commit | aaced5633b81b2f08b993106a527e2a0e1d663c1 (patch) | |
tree | 092234ac7a2953d303bfa7060f07f544fa4b6e58 /src | |
parent | e7333b420e35054d9302f9c58fd47b6152cbd35f (diff) | |
download | bitcoin-aaced5633b81b2f08b993106a527e2a0e1d663c1.tar.xz |
refactor: Move error() from util/system.h to logging.h
error is a low-level function with a sole dependency on LogPrintf, which
is defined in logging.h
The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from the ArgsManager defined in system.h.
Moving the function out of system.h allows including it from a separate
source file without including the ArgsManager definitions from system.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/addrdb.cpp | 1 | ||||
-rw-r--r-- | src/index/base.cpp | 1 | ||||
-rw-r--r-- | src/index/coinstatsindex.cpp | 1 | ||||
-rw-r--r-- | src/index/txindex.cpp | 1 | ||||
-rw-r--r-- | src/kernel/coinstats.cpp | 2 | ||||
-rw-r--r-- | src/logging.h | 7 | ||||
-rw-r--r-- | src/net.cpp | 3 | ||||
-rw-r--r-- | src/netbase.cpp | 2 | ||||
-rw-r--r-- | src/node/blockstorage.cpp | 1 | ||||
-rw-r--r-- | src/script/signingprovider.cpp | 2 | ||||
-rw-r--r-- | src/txdb.cpp | 2 | ||||
-rw-r--r-- | src/util/system.h | 7 |
12 files changed, 18 insertions, 12 deletions
diff --git a/src/addrdb.cpp b/src/addrdb.cpp index 7be13c8f1e..9ae8244d1c 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -11,6 +11,7 @@ #include <cstdint> #include <fs.h> #include <hash.h> +#include <logging.h> #include <logging/timer.h> #include <netbase.h> #include <netgroup.h> diff --git a/src/index/base.cpp b/src/index/base.cpp index 7c570d4534..8a311296c2 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -6,6 +6,7 @@ #include <index/base.h> #include <interfaces/chain.h> #include <kernel/chain.h> +#include <logging.h> #include <node/blockstorage.h> #include <node/context.h> #include <node/database_args.h> diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index 8cece7d78d..4d637e217a 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -7,6 +7,7 @@ #include <crypto/muhash.h> #include <index/coinstatsindex.h> #include <kernel/coinstats.h> +#include <logging.h> #include <node/blockstorage.h> #include <serialize.h> #include <txdb.h> diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 25ccc3e636..9095e7afeb 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -5,6 +5,7 @@ #include <index/txindex.h> #include <index/disktxpos.h> +#include <logging.h> #include <node/blockstorage.h> #include <util/system.h> #include <validation.h> diff --git a/src/kernel/coinstats.cpp b/src/kernel/coinstats.cpp index 82d7d8c46b..4b75c387a6 100644 --- a/src/kernel/coinstats.cpp +++ b/src/kernel/coinstats.cpp @@ -8,6 +8,7 @@ #include <coins.h> #include <crypto/muhash.h> #include <hash.h> +#include <logging.h> #include <node/blockstorage.h> #include <primitives/transaction.h> #include <script/script.h> @@ -19,7 +20,6 @@ #include <uint256.h> #include <util/check.h> #include <util/overflow.h> -#include <util/system.h> #include <validation.h> #include <version.h> diff --git a/src/logging.h b/src/logging.h index 35fb598cef..954731d214 100644 --- a/src/logging.h +++ b/src/logging.h @@ -257,4 +257,11 @@ static inline void LogPrintf_(const std::string& logging_function, const std::st } \ } while (0) +template <typename... Args> +bool error(const char* fmt, const Args&... args) +{ + LogPrintf("ERROR: %s\n", tfm::format(fmt, args...)); + return false; +} + #endif // BITCOIN_LOGGING_H diff --git a/src/net.cpp b/src/net.cpp index 4e4f2f78be..d1895b7172 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -16,12 +16,13 @@ #include <compat/compat.h> #include <consensus/consensus.h> #include <crypto/sha256.h> -#include <node/eviction.h> #include <fs.h> #include <i2p.h> +#include <logging.h> #include <net_permissions.h> #include <netaddress.h> #include <netbase.h> +#include <node/eviction.h> #include <node/interface_ui.h> #include <protocol.h> #include <random.h> diff --git a/src/netbase.cpp b/src/netbase.cpp index 797f1e17f2..f39a3635f4 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -6,12 +6,12 @@ #include <netbase.h> #include <compat/compat.h> +#include <logging.h> #include <sync.h> #include <tinyformat.h> #include <util/sock.h> #include <util/strencodings.h> #include <util/string.h> -#include <util/system.h> #include <util/time.h> #include <atomic> diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index c0a25572fc..255b73b347 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -11,6 +11,7 @@ #include <flatfile.h> #include <fs.h> #include <hash.h> +#include <logging.h> #include <pow.h> #include <reverse_iterator.h> #include <shutdown.h> diff --git a/src/script/signingprovider.cpp b/src/script/signingprovider.cpp index 5123dd81ac..ef055573b9 100644 --- a/src/script/signingprovider.cpp +++ b/src/script/signingprovider.cpp @@ -7,7 +7,7 @@ #include <script/signingprovider.h> #include <script/standard.h> -#include <util/system.h> +#include <logging.h> const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider(); diff --git a/src/txdb.cpp b/src/txdb.cpp index 7257fb4959..15351a4355 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -6,11 +6,11 @@ #include <txdb.h> #include <chain.h> +#include <logging.h> #include <pow.h> #include <random.h> #include <shutdown.h> #include <uint256.h> -#include <util/system.h> #include <util/translation.h> #include <util/vector.h> diff --git a/src/util/system.h b/src/util/system.h index 2d07e64345..7292262bea 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -43,13 +43,6 @@ extern const char * const BITCOIN_SETTINGS_FILENAME; void SetupEnvironment(); bool SetupNetworking(); -template<typename... Args> -bool error(const char* fmt, const Args&... args) -{ - LogPrintf("ERROR: %s\n", tfm::format(fmt, args...)); - return false; -} - /** * Ensure file contents are fully committed to disk, using a platform-specific * feature analogous to fsync(). |