mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
scripted-diff: Use inline constexpr over (static) const
Both are fine and this refactor shouldn't change any behavior.
However, inline constexpr will ensure each symbol has a single address
across all TU, making the release binary smaller.
Note, a follow-up commit will deal with string literals (const char*)
and other static const, which can not be constexpr (e.g. std::vector).
-BEGIN VERIFY SCRIPT-
# Limit to types that can be constexpr
type='bool|CAmount|size_t|((signed|unsigned) )?int|u?int[0-9]+_t|std::array|DatabaseFormat|CFeeRate|std::streamsize'
sed -i --regexp-extended "s/^(static )?const (${type})\>/inline constexpr \2/" $( \
git grep -l --extended-regexp "^(static )?const " -- \
'*.h' \
':(exclude)src/leveldb' \
':(exclude)src/secp256k1' \
)
-END VERIFY SCRIPT-
This commit is contained in:
@@ -32,15 +32,15 @@ class SignalInterrupt;
|
||||
/**
|
||||
* The default value for `-rpcthreads`. This number of threads will be created at startup.
|
||||
*/
|
||||
static const int DEFAULT_HTTP_THREADS=16;
|
||||
inline constexpr int DEFAULT_HTTP_THREADS=16;
|
||||
|
||||
/**
|
||||
* The default value for `-rpcworkqueue`. This is the maximum depth of the work queue,
|
||||
* we don't allocate this number of work queue items upfront.
|
||||
*/
|
||||
static const int DEFAULT_HTTP_WORKQUEUE=64;
|
||||
inline constexpr int DEFAULT_HTTP_WORKQUEUE=64;
|
||||
|
||||
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||
inline constexpr int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||
|
||||
enum class HTTPRequestMethod {
|
||||
UNKNOWN,
|
||||
|
||||
Reference in New Issue
Block a user