Skip to content

Commit

Permalink
Merge bitcoin#15622: Remove global symbols: Avoid using the global na…
Browse files Browse the repository at this point in the history
…mespace if possible

fb43415 Remove global symbols: Avoid using the global namespace if possible (practicalswift)

Pull request description:

  Remove global symbols: Avoid using the global namespace if possible.

  Partially resolves bitcoin#15612 ("Reduce the number of global symbols used").

  Change in global symbols as reported by `nm bitcoind` before vs after:

  ```
  $ diff -u <(nm src/bitcoind-before | c++filt | grep -E '^[0-9a-f]+ [A-Z] ' | cut -f3- -d' ' | sort -u) \
            <(nm src/bitcoind-after  | c++filt | grep -E '^[0-9a-f]+ [A-Z] ' | cut -f3- -d' ' | sort -u) \
            | grep -E '^[+-][^+-]'
  -boundSockets
  -cs_warnings
  -eventHTTP
  -fFeeEstimatesInitialized
  -fLargeWorkForkFound
  -fLargeWorkInvalidChainFound
  -pathHandlers
  -strMiscWarning[abi:cxx11]
  -threadHTTP
  ```

ACKs for commit fb4341:

Tree-SHA512: d2f78f6188a992b0e0de8d107e2c494cfa0faa2de4fda634a1d3606d6515633bec86289cf2a2e78ffe467b17b795e2243cc459fb44e0dfe2fc69899506ff61c9
  • Loading branch information
MarcoFalke authored and PastaPastaPasta committed Jun 27, 2021
1 parent 4f416ff commit 9936bfe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/httpserver.cpp
Expand Up @@ -144,15 +144,15 @@ struct HTTPPathHandler
//! libevent event loop
static struct event_base* eventBase = nullptr;
//! HTTP server
struct evhttp* eventHTTP = nullptr;
static struct evhttp* eventHTTP = nullptr;
//! List of subnets to allow RPC connections from
static std::vector<CSubNet> rpc_allow_subnets;
//! Work queue for handling longer requests off the event loop thread
static WorkQueue<HTTPClosure>* workQueue = nullptr;
//! Handlers for (sub)paths
std::vector<HTTPPathHandler> pathHandlers;
static std::vector<HTTPPathHandler> pathHandlers;
//! Bound listening sockets
std::vector<evhttp_bound_socket *> boundSockets;
static std::vector<evhttp_bound_socket *> boundSockets;

/** Check if a network address is allowed to access the HTTP server */
static bool ClientAllowed(const CNetAddr& netaddr)
Expand Down Expand Up @@ -433,7 +433,7 @@ bool UpdateHTTPServerLogging(bool enable) {
#endif
}

std::thread threadHTTP;
static std::thread threadHTTP;
static std::vector<std::thread> g_thread_http_workers;

bool StartHTTPServer()
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Expand Up @@ -93,7 +93,7 @@
#include <zmq/zmqrpc.h>
#endif

bool fFeeEstimatesInitialized = false;
static bool fFeeEstimatesInitialized = false;
static const bool DEFAULT_PROXYRANDOMIZE = true;
static const bool DEFAULT_REST_ENABLE = false;
static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
Expand Down
8 changes: 4 additions & 4 deletions src/warnings.cpp
Expand Up @@ -9,10 +9,10 @@
#include <warnings.h>
#include <hash.h>

CCriticalSection cs_warnings;
std::string strMiscWarning GUARDED_BY(cs_warnings);
bool fLargeWorkForkFound GUARDED_BY(cs_warnings) = false;
bool fLargeWorkInvalidChainFound GUARDED_BY(cs_warnings) = false;
static RecursiveMutex cs_warnings;
static std::string strMiscWarning GUARDED_BY(cs_warnings);
static bool fLargeWorkForkFound GUARDED_BY(cs_warnings) = false;
static bool fLargeWorkInvalidChainFound GUARDED_BY(cs_warnings) = false;

void SetMiscWarning(const std::string& strWarning)
{
Expand Down

0 comments on commit 9936bfe

Please sign in to comment.