0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00

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.
This commit is contained in:
Ben Woosley 2023-03-06 22:01:13 +01:00 committed by TheCharlatan
parent e7333b420e
commit aaced5633b
No known key found for this signature in database
GPG key ID: 9B79B45691DB4173
12 changed files with 18 additions and 12 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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();

View file

@ -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>

View file

@ -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().