Merge bitcoin/bitcoin#21902: refactor: Remove useless extern keyword

fa4bbd306e refactor: Remove useless extern keyword (MarcoFalke)

Pull request description:

  It is redundant, confusing and useless.

  https://en.cppreference.com/w/cpp/language/storage_duration#external_linkage

ACKs for top commit:
  practicalswift:
    cr ACK fa4bbd306e: patch looks correct
  Talkless:
    utACK fa4bbd306e, built successfully on Debian Sid, looks OK.
  jonatack:
    Light code review ACK fa4bbd306e
  hebasto:
    ACK fa4bbd306e, I've verified that all of the remained `extern` keywords specify either (a) a variable with external linkage, or (b) a symbol with "C" language linkage.
  promag:
    Code review ACK fa4bbd306e.

Tree-SHA512: 1d77d661132defa52ccb2046f7a287deb3669b68835e40ab75a0d9d08fe6efeaf3bea7c0e76c754fd18bfe45972c253a39462014080d014cc5d810498784e3e4
This commit is contained in:
fanquake 2021-05-11 08:52:06 +10:00
commit 4a26705761
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1
6 changed files with 14 additions and 15 deletions

View File

@ -72,10 +72,10 @@ void RPCTypeCheckObj(const UniValue& o,
* Utilities: convert hex-encoded Values * Utilities: convert hex-encoded Values
* (throws error if not hex). * (throws error if not hex).
*/ */
extern uint256 ParseHashV(const UniValue& v, std::string strName); uint256 ParseHashV(const UniValue& v, std::string strName);
extern uint256 ParseHashO(const UniValue& o, std::string strKey); uint256 ParseHashO(const UniValue& o, std::string strKey);
extern std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName); std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName);
extern std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey); std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);
/** /**
* Validate and return a CAmount from a UniValue number or string. * Validate and return a CAmount from a UniValue number or string.
@ -84,13 +84,13 @@ extern std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKe
* @param[in] decimals Number of significant digits (default: 8). * @param[in] decimals Number of significant digits (default: 8).
* @returns a CAmount if the various checks pass. * @returns a CAmount if the various checks pass.
*/ */
extern CAmount AmountFromValue(const UniValue& value, int decimals = 8); CAmount AmountFromValue(const UniValue& value, int decimals = 8);
using RPCArgList = std::vector<std::pair<std::string, UniValue>>; using RPCArgList = std::vector<std::pair<std::string, UniValue>>;
extern std::string HelpExampleCli(const std::string& methodname, const std::string& args); std::string HelpExampleCli(const std::string& methodname, const std::string& args);
extern std::string HelpExampleCliNamed(const std::string& methodname, const RPCArgList& args); std::string HelpExampleCliNamed(const std::string& methodname, const RPCArgList& args);
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args); std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
extern std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args); std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
CPubKey HexToPubKey(const std::string& hex_in); CPubKey HexToPubKey(const std::string& hex_in);
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in); CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);

View File

@ -16,7 +16,7 @@
using namespace std::literals; using namespace std::literals;
extern UniValue read_json(const std::string& jsondata); UniValue read_json(const std::string& jsondata);
BOOST_FIXTURE_TEST_SUITE(base58_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(base58_tests, BasicTestingSetup)

View File

@ -15,7 +15,7 @@
#include <univalue.h> #include <univalue.h>
extern UniValue read_json(const std::string& jsondata); UniValue read_json(const std::string& jsondata);
BOOST_FIXTURE_TEST_SUITE(key_io_tests, BasicTestingSetup) BOOST_FIXTURE_TEST_SUITE(key_io_tests, BasicTestingSetup)

View File

@ -39,8 +39,7 @@ static const unsigned int gFlags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
unsigned int ParseScriptFlags(std::string strFlags); unsigned int ParseScriptFlags(std::string strFlags);
std::string FormatScriptFlags(unsigned int flags); std::string FormatScriptFlags(unsigned int flags);
UniValue UniValue read_json(const std::string& jsondata)
read_json(const std::string& jsondata)
{ {
UniValue v; UniValue v;

View File

@ -21,7 +21,7 @@
#include <univalue.h> #include <univalue.h>
extern UniValue read_json(const std::string& jsondata); UniValue read_json(const std::string& jsondata);
// Old script.cpp SignatureHash function // Old script.cpp SignatureHash function
uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType) uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType)

View File

@ -39,7 +39,7 @@
typedef std::vector<unsigned char> valtype; typedef std::vector<unsigned char> valtype;
// In script_tests.cpp // In script_tests.cpp
extern UniValue read_json(const std::string& jsondata); UniValue read_json(const std::string& jsondata);
static std::map<std::string, unsigned int> mapFlagNames = { static std::map<std::string, unsigned int> mapFlagNames = {
{std::string("P2SH"), (unsigned int)SCRIPT_VERIFY_P2SH}, {std::string("P2SH"), (unsigned int)SCRIPT_VERIFY_P2SH},