refactor: Use TranslateFn type consistently

The type was introduced in the previous commit.
This commit is contained in:
MarcoFalke 2025-01-15 12:15:40 +01:00
parent eeee6cf2ff
commit fa1d5acb8d
No known key found for this signature in database
8 changed files with 9 additions and 8 deletions

View file

@ -50,7 +50,7 @@ using util::ToString;
// just use a plain system_clock.
using CliClock = std::chrono::system_clock;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;

View file

@ -41,7 +41,7 @@ static bool fCreateBlank;
static std::map<std::string,UniValue> registers;
static const int CONTINUE_EXECUTION=-1;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
static void SetupBitcoinTxArgs(ArgsManager &argsman)
{

View file

@ -26,7 +26,7 @@
static const int CONTINUE_EXECUTION=-1;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
static void SetupBitcoinUtilArgs(ArgsManager &argsman)
{

View file

@ -26,7 +26,7 @@
using util::Join;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
static void SetupWalletToolArgs(ArgsManager& argsman)
{

View file

@ -34,7 +34,7 @@
using node::NodeContext;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
#if HAVE_DECL_FORK

View file

@ -1,10 +1,11 @@
// Copyright (c) 2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/translation.h>
#include <functional>
#include <string>
// Define G_TRANSLATION_FUN symbol in libbitcoinkernel library so users of the
// library aren't required to export this symbol
extern const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
extern const TranslateFn G_TRANSLATION_FUN{nullptr};

View file

@ -13,7 +13,7 @@
#include <string>
/** Translate string to current locale using Qt. */
extern const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) {
extern const TranslateFn G_TRANSLATION_FUN = [](const char* psz) {
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
};

View file

@ -72,7 +72,7 @@ using node::LoadChainstate;
using node::RegenerateCommitments;
using node::VerifyLoadedChainstate;
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
const TranslateFn G_TRANSLATION_FUN{nullptr};
constexpr inline auto TEST_DIR_PATH_ELEMENT{"test_common bitcoin"}; // Includes a space to catch possible path escape issues.
/** Random context to get unique temp data dirs. Separate from m_rng, which can be seeded from a const env var */