Skip to content

Commit f82e1c9

Browse files
author
MarcoFalke
committed
Merge #13163: Make it clear which functions that are intended to be translation unit local
c3f34d0 Make it clear which functions that are intended to be translation unit local (practicalswift) Pull request description: Make it clear which functions that are intended to be translation unit local. Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently. Tree-SHA512: 05eebd233d5cfbf6116724eec3a99b465bf534ca220f2b6f5e56341a7da41387454d3cb6ceadd8ab6714a5df94069e4ad0dcab8801ccc7e8949be7199a19fb53
2 parents 627c376 + c3f34d0 commit f82e1c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+226
-226
lines changed

src/bench/prevector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static void PrevectorClear(benchmark::State& state)
4848
}
4949

5050
template <typename T>
51-
void PrevectorResize(benchmark::State& state)
51+
static void PrevectorResize(benchmark::State& state)
5252
{
5353
while (state.KeepRunning()) {
5454
prevector<28, T> t0;

src/bitcoin-cli.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
2929
static const bool DEFAULT_NAMED=false;
3030
static const int CONTINUE_EXECUTION=-1;
3131

32-
std::string HelpMessageCli()
32+
static std::string HelpMessageCli()
3333
{
3434
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
3535
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
@@ -138,7 +138,7 @@ struct HTTPReply
138138
std::string body;
139139
};
140140

141-
const char *http_errorstring(int code)
141+
static const char *http_errorstring(int code)
142142
{
143143
switch(code) {
144144
#if LIBEVENT_VERSION_NUMBER >= 0x02010300
@@ -387,7 +387,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co
387387
return reply;
388388
}
389389

390-
int CommandLineRPC(int argc, char *argv[])
390+
static int CommandLineRPC(int argc, char *argv[])
391391
{
392392
std::string strPrint;
393393
int nRet = 0;

src/bitcoind.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
* Use the buttons <code>Namespaces</code>, <code>Classes</code> or <code>Files</code> at the top of the page to start navigating the code.
4141
*/
4242

43-
void WaitForShutdown()
43+
static void WaitForShutdown()
4444
{
4545
while (!ShutdownRequested())
4646
{
@@ -53,7 +53,7 @@ void WaitForShutdown()
5353
//
5454
// Start
5555
//
56-
bool AppInit(int argc, char* argv[])
56+
static bool AppInit(int argc, char* argv[])
5757
{
5858
bool fRet = false;
5959

src/core_read.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CScript ParseScript(const std::string& s)
8888
}
8989

9090
// Check that all of the input and output scripts of a transaction contains valid opcodes
91-
bool CheckTxScriptsSanity(const CMutableTransaction& tx)
91+
static bool CheckTxScriptsSanity(const CMutableTransaction& tx)
9292
{
9393
// Check input scripts for non-coinbase txs
9494
if (!CTransaction(tx).IsCoinBase()) {

src/init.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ static void registerSignalHandler(int signal, void(*handler)(int))
319319
}
320320
#endif
321321

322-
void OnRPCStarted()
322+
static void OnRPCStarted()
323323
{
324324
uiInterface.NotifyBlockTip.connect(&RPCNotifyBlockChange);
325325
}
326326

327-
void OnRPCStopped()
327+
static void OnRPCStopped()
328328
{
329329
uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange);
330330
RPCNotifyBlockChange(false, nullptr);
@@ -595,7 +595,7 @@ struct CImportingNow
595595
// rev files since they'll be rewritten by the reindex anyway. This ensures that vinfoBlockFile
596596
// is in sync with what's actually on disk by the time we start downloading, so that pruning
597597
// works correctly.
598-
void CleanupBlockRevFiles()
598+
static void CleanupBlockRevFiles()
599599
{
600600
std::map<std::string, fs::path> mapBlockFiles;
601601

@@ -630,7 +630,7 @@ void CleanupBlockRevFiles()
630630
}
631631
}
632632

633-
void ThreadImport(std::vector<fs::path> vImportFiles)
633+
static void ThreadImport(std::vector<fs::path> vImportFiles)
634634
{
635635
const CChainParams& chainparams = Params();
636636
RenameThread("bitcoin-loadblk");
@@ -709,7 +709,7 @@ void ThreadImport(std::vector<fs::path> vImportFiles)
709709
* Ensure that Bitcoin is running in a usable environment with all
710710
* necessary library support.
711711
*/
712-
bool InitSanityCheck(void)
712+
static bool InitSanityCheck(void)
713713
{
714714
if(!ECC_InitSanityCheck()) {
715715
InitError("Elliptic curve cryptography sanity check failure. Aborting.");
@@ -727,7 +727,7 @@ bool InitSanityCheck(void)
727727
return true;
728728
}
729729

730-
bool AppInitServers()
730+
static bool AppInitServers()
731731
{
732732
RPCServer::OnStarted(&OnRPCStarted);
733733
RPCServer::OnStopped(&OnRPCStopped);

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer, ServiceFlags nLocalServices)
160160
return ret;
161161
}
162162

163-
int GetnScore(const CService& addr)
163+
static int GetnScore(const CService& addr)
164164
{
165165
LOCK(cs_mapLocalHost);
166166
if (mapLocalHost.count(addr) == LOCAL_NONE)
@@ -1466,7 +1466,7 @@ void CConnman::WakeMessageHandler()
14661466
#ifdef USE_UPNP
14671467
static CThreadInterrupt g_upnp_interrupt;
14681468
static std::thread g_upnp_thread;
1469-
void ThreadMapPort()
1469+
static void ThreadMapPort()
14701470
{
14711471
std::string port = strprintf("%u", GetListenPort());
14721472
const char * multicastif = nullptr;

src/net_processing.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ CNodeState *State(NodeId pnode) {
277277
return &it->second;
278278
}
279279

280-
void UpdatePreferredDownload(CNode* node, CNodeState* state)
280+
static void UpdatePreferredDownload(CNode* node, CNodeState* state)
281281
{
282282
nPreferredDownload -= state->fPreferredDownload;
283283

@@ -287,7 +287,7 @@ void UpdatePreferredDownload(CNode* node, CNodeState* state)
287287
nPreferredDownload += state->fPreferredDownload;
288288
}
289289

290-
void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
290+
static void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
291291
{
292292
ServiceFlags nLocalNodeServices = pnode->GetLocalServices();
293293
uint64_t nonce = pnode->GetLocalNonce();
@@ -311,7 +311,7 @@ void PushNodeVersion(CNode *pnode, CConnman* connman, int64_t nTime)
311311
// Requires cs_main.
312312
// Returns a bool indicating whether we requested this block.
313313
// Also used if a block was /not/ received and timed out or started with another peer
314-
bool MarkBlockAsReceived(const uint256& hash) {
314+
static bool MarkBlockAsReceived(const uint256& hash) {
315315
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
316316
if (itInFlight != mapBlocksInFlight.end()) {
317317
CNodeState *state = State(itInFlight->second.first);
@@ -337,7 +337,7 @@ bool MarkBlockAsReceived(const uint256& hash) {
337337
// Requires cs_main.
338338
// returns false, still setting pit, if the block was already in flight from the same peer
339339
// pit will only be valid as long as the same cs_main lock is being held
340-
bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex* pindex = nullptr, std::list<QueuedBlock>::iterator** pit = nullptr) {
340+
static bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex* pindex = nullptr, std::list<QueuedBlock>::iterator** pit = nullptr) {
341341
CNodeState *state = State(nodeid);
342342
assert(state != nullptr);
343343

@@ -371,7 +371,7 @@ bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex*
371371
}
372372

373373
/** Check whether the last unknown block a peer advertised is not yet known. */
374-
void ProcessBlockAvailability(NodeId nodeid) {
374+
static void ProcessBlockAvailability(NodeId nodeid) {
375375
CNodeState *state = State(nodeid);
376376
assert(state != nullptr);
377377

@@ -387,7 +387,7 @@ void ProcessBlockAvailability(NodeId nodeid) {
387387
}
388388

389389
/** Update tracking information about which blocks a peer is assumed to have. */
390-
void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
390+
static void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
391391
CNodeState *state = State(nodeid);
392392
assert(state != nullptr);
393393

@@ -411,7 +411,7 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
411411
* lNodesAnnouncingHeaderAndIDs, and keeping that list under a certain size by
412412
* removing the first element if necessary.
413413
*/
414-
void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
414+
static void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
415415
AssertLockHeld(cs_main);
416416
CNodeState* nodestate = State(nodeid);
417417
if (!nodestate || !nodestate->fSupportsDesiredCmpctVersion) {
@@ -444,7 +444,7 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
444444
}
445445
}
446446

447-
bool TipMayBeStale(const Consensus::Params &consensusParams)
447+
static bool TipMayBeStale(const Consensus::Params &consensusParams)
448448
{
449449
AssertLockHeld(cs_main);
450450
if (g_last_tip_update == 0) {
@@ -454,13 +454,13 @@ bool TipMayBeStale(const Consensus::Params &consensusParams)
454454
}
455455

456456
// Requires cs_main
457-
bool CanDirectFetch(const Consensus::Params &consensusParams)
457+
static bool CanDirectFetch(const Consensus::Params &consensusParams)
458458
{
459459
return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - consensusParams.nPowTargetSpacing * 20;
460460
}
461461

462462
// Requires cs_main
463-
bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex)
463+
static bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex)
464464
{
465465
if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight))
466466
return true;
@@ -471,7 +471,7 @@ bool PeerHasHeader(CNodeState *state, const CBlockIndex *pindex)
471471

472472
/** Update pindexLastCommonBlock and add not-in-flight missing successors to vBlocks, until it has
473473
* at most count entries. */
474-
void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller, const Consensus::Params& consensusParams) {
474+
static void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller, const Consensus::Params& consensusParams) {
475475
if (count == 0)
476476
return;
477477

@@ -570,7 +570,7 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
570570

571571
// Returns true for outbound peers, excluding manual connections, feelers, and
572572
// one-shots
573-
bool IsOutboundDisconnectionCandidate(const CNode *node)
573+
static bool IsOutboundDisconnectionCandidate(const CNode *node)
574574
{
575575
return !(node->fInbound || node->m_manual_connection || node->fFeeler || node->fOneShot);
576576
}
@@ -642,7 +642,7 @@ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
642642
// mapOrphanTransactions
643643
//
644644

645-
void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
645+
static void AddToCompactExtraTransactions(const CTransactionRef& tx) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans)
646646
{
647647
size_t max_extra_txn = gArgs.GetArg("-blockreconstructionextratxn", DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN);
648648
if (max_extra_txn <= 0)
@@ -1280,7 +1280,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
12801280
}
12811281
}
12821282

1283-
uint32_t GetFetchFlags(CNode* pfrom) {
1283+
static uint32_t GetFetchFlags(CNode* pfrom) {
12841284
uint32_t nFetchFlags = 0;
12851285
if ((pfrom->GetLocalServices() & NODE_WITNESS) && State(pfrom->GetId())->fHaveWitness) {
12861286
nFetchFlags |= MSG_WITNESS_FLAG;

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ struct ProxyCredentials
289289
};
290290

291291
/** Convert SOCKS5 reply to an error message */
292-
std::string Socks5ErrorString(uint8_t err)
292+
static std::string Socks5ErrorString(uint8_t err)
293293
{
294294
switch(err) {
295295
case SOCKS5Reply::GENFAILURE:

src/random.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void RandAddSeedPerfmon()
178178
/** Fallback: get 32 bytes of system entropy from /dev/urandom. The most
179179
* compatible way to get cryptographic randomness on UNIX-ish platforms.
180180
*/
181-
void GetDevURandom(unsigned char *ent32)
181+
static void GetDevURandom(unsigned char *ent32)
182182
{
183183
int f = open("/dev/urandom", O_RDONLY);
184184
if (f == -1) {

0 commit comments

Comments
 (0)