Skip to content

Commit fa1d5ac

Browse files
author
MarcoFalke
committed
refactor: Use TranslateFn type consistently
The type was introduced in the previous commit.
1 parent eeee6cf commit fa1d5ac

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using util::ToString;
5050
// just use a plain system_clock.
5151
using CliClock = std::chrono::system_clock;
5252

53-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
53+
const TranslateFn G_TRANSLATION_FUN{nullptr};
5454

5555
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
5656
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;

src/bitcoin-tx.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static bool fCreateBlank;
4141
static std::map<std::string,UniValue> registers;
4242
static const int CONTINUE_EXECUTION=-1;
4343

44-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
44+
const TranslateFn G_TRANSLATION_FUN{nullptr};
4545

4646
static void SetupBitcoinTxArgs(ArgsManager &argsman)
4747
{

src/bitcoin-util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
static const int CONTINUE_EXECUTION=-1;
2828

29-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
29+
const TranslateFn G_TRANSLATION_FUN{nullptr};
3030

3131
static void SetupBitcoinUtilArgs(ArgsManager &argsman)
3232
{

src/bitcoin-wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
using util::Join;
2828

29-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
29+
const TranslateFn G_TRANSLATION_FUN{nullptr};
3030

3131
static void SetupWalletToolArgs(ArgsManager& argsman)
3232
{

src/bitcoind.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
using node::NodeContext;
3636

37-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
37+
const TranslateFn G_TRANSLATION_FUN{nullptr};
3838

3939
#if HAVE_DECL_FORK
4040

src/kernel/bitcoinkernel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Copyright (c) 2022 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
#include <util/translation.h>
45

56
#include <functional>
67
#include <string>
78

89
// Define G_TRANSLATION_FUN symbol in libbitcoinkernel library so users of the
910
// library aren't required to export this symbol
10-
extern const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
11+
extern const TranslateFn G_TRANSLATION_FUN{nullptr};

src/qt/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <string>
1414

1515
/** Translate string to current locale using Qt. */
16-
extern const std::function<std::string(const char*)> G_TRANSLATION_FUN = [](const char* psz) {
16+
extern const TranslateFn G_TRANSLATION_FUN = [](const char* psz) {
1717
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
1818
};
1919

src/test/util/setup_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ using node::LoadChainstate;
7272
using node::RegenerateCommitments;
7373
using node::VerifyLoadedChainstate;
7474

75-
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
75+
const TranslateFn G_TRANSLATION_FUN{nullptr};
7676

7777
constexpr inline auto TEST_DIR_PATH_ELEMENT{"test_common bitcoin"}; // Includes a space to catch possible path escape issues.
7878
/** Random context to get unique temp data dirs. Separate from m_rng, which can be seeded from a const env var */

0 commit comments

Comments
 (0)