Skip to content

Commit

Permalink
Merge bitcoin#21902: refactor: Remove useless extern keyword
Browse files Browse the repository at this point in the history
fa4bbd3 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 fa4bbd3: patch looks correct
  Talkless:
    utACK fa4bbd3, built successfully on Debian Sid, looks OK.
  jonatack:
    Light code review ACK fa4bbd3
  hebasto:
    ACK fa4bbd3, 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 fa4bbd3.

Tree-SHA512: 1d77d661132defa52ccb2046f7a287deb3669b68835e40ab75a0d9d08fe6efeaf3bea7c0e76c754fd18bfe45972c253a39462014080d014cc5d810498784e3e4
  • Loading branch information
fanquake committed May 10, 2021
2 parents 4bc3b16 + fa4bbd3 commit 4a26705
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/rpc/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ void RPCTypeCheckObj(const UniValue& o,
* Utilities: convert hex-encoded Values
* (throws error if not hex).
*/
extern uint256 ParseHashV(const UniValue& v, std::string strName);
extern uint256 ParseHashO(const UniValue& o, std::string strKey);
extern std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName);
extern std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);
uint256 ParseHashV(const UniValue& v, std::string strName);
uint256 ParseHashO(const UniValue& o, std::string strKey);
std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName);
std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);

/**
* Validate and return a CAmount from a UniValue number or string.
Expand All @@ -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).
* @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>>;
extern std::string HelpExampleCli(const std::string& methodname, const std::string& args);
extern std::string HelpExampleCliNamed(const std::string& methodname, const RPCArgList& args);
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
extern std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
std::string HelpExampleCli(const std::string& methodname, const std::string& args);
std::string HelpExampleCliNamed(const std::string& methodname, const RPCArgList& args);
std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);

CPubKey HexToPubKey(const std::string& hex_in);
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);
Expand Down
2 changes: 1 addition & 1 deletion src/test/base58_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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)

Expand Down
2 changes: 1 addition & 1 deletion src/test/key_io_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#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)

Expand Down
3 changes: 1 addition & 2 deletions src/test/script_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ static const unsigned int gFlags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
unsigned int ParseScriptFlags(std::string strFlags);
std::string FormatScriptFlags(unsigned int flags);

UniValue
read_json(const std::string& jsondata)
UniValue read_json(const std::string& jsondata)
{
UniValue v;

Expand Down
2 changes: 1 addition & 1 deletion src/test/sighash_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <univalue.h>

extern UniValue read_json(const std::string& jsondata);
UniValue read_json(const std::string& jsondata);

// Old script.cpp SignatureHash function
uint256 static SignatureHashOld(CScript scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType)
Expand Down
2 changes: 1 addition & 1 deletion src/test/transaction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
typedef std::vector<unsigned char> valtype;

// 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 = {
{std::string("P2SH"), (unsigned int)SCRIPT_VERIFY_P2SH},
Expand Down

0 comments on commit 4a26705

Please sign in to comment.