aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrotcrunsher <Brotcrunsher@hotmail.de>2023-06-04 18:34:48 +0200
committerBrotcrunsher <Brotcrunsher@hotmail.de>2023-06-20 10:23:08 +0200
commitbdea2bb1147bbd22f8b4fa406262470f9d084215 (patch)
tree67b9656e7055dd9c0cc0954d53a2af5174c891b5
parent8f402710371a40c5777dc3f9c4ba6ca8505a2f90 (diff)
scripted-diff: Following the C++ Standard rules for identifiers with _.
Any identifier starting with two _, or one _ followed by a capital letter is reserved for the compiler and thus must not be used. See: https://stackoverflow.com/a/228797/7130273 -BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s '__pushKV' 'pushKVEnd' s '_EraseTx' 'EraseTxNoLock' s '_Other' 'Other' -END VERIFY SCRIPT-
-rw-r--r--src/common/settings.cpp2
-rw-r--r--src/rpc/client.cpp4
-rw-r--r--src/rpc/mempool.cpp4
-rw-r--r--src/rpc/server.cpp2
-rw-r--r--src/support/allocators/secure.h4
-rw-r--r--src/support/allocators/zeroafterfree.h4
-rw-r--r--src/test/settings_tests.cpp2
-rw-r--r--src/txorphanage.cpp12
-rw-r--r--src/txorphanage.h2
-rw-r--r--src/univalue/include/univalue.h2
-rw-r--r--src/univalue/lib/univalue.cpp6
-rw-r--r--src/univalue/test/object.cpp4
-rw-r--r--src/wallet/rpc/addresses.cpp4
13 files changed, 26 insertions, 26 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 9187f242eb..5761e8b321 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -115,7 +115,7 @@ bool WriteSettings(const fs::path& path,
{
SettingsValue out(SettingsValue::VOBJ);
for (const auto& value : values) {
- out.__pushKV(value.first, value.second);
+ out.pushKVEnd(value.first, value.second);
}
std::ofstream file;
file.open(path);
diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp
index edc0fb05d7..5f58eef1db 100644
--- a/src/rpc/client.cpp
+++ b/src/rpc/client.cpp
@@ -371,10 +371,10 @@ UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<s
}
if (!positional_args.empty()) {
- // Use __pushKV instead of pushKV to avoid overwriting an explicit
+ // Use pushKVEnd instead of pushKV to avoid overwriting an explicit
// "args" value with an implicit one. Let the RPC server handle the
// request as given.
- params.__pushKV("args", positional_args);
+ params.pushKVEnd("args", positional_args);
}
return params;
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index 89c403b6f5..11d2874961 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -351,8 +351,8 @@ UniValue MempoolToJSON(const CTxMemPool& pool, bool verbose, bool include_mempoo
entryToJSON(pool, info, e);
// Mempool has unique entries so there is no advantage in using
// UniValue::pushKV, which checks if the key already exists in O(N).
- // UniValue::__pushKV is used instead which currently is O(1).
- o.__pushKV(hash.ToString(), info);
+ // UniValue::pushKVEnd is used instead which currently is O(1).
+ o.pushKVEnd(hash.ToString(), info);
}
return o;
} else {
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index d39efcb245..daf751111f 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -437,7 +437,7 @@ static inline JSONRPCRequest transformNamedArguments(const JSONRPCRequest& in, c
if (options.exists(fr->first)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Parameter " + fr->first + " specified multiple times");
}
- options.__pushKV(fr->first, *fr->second);
+ options.pushKVEnd(fr->first, *fr->second);
argsIn.erase(fr);
}
continue;
diff --git a/src/support/allocators/secure.h b/src/support/allocators/secure.h
index a0918bf463..b2076bea07 100644
--- a/src/support/allocators/secure.h
+++ b/src/support/allocators/secure.h
@@ -32,9 +32,9 @@ struct secure_allocator : public std::allocator<T> {
{
}
~secure_allocator() noexcept {}
- template <typename _Other>
+ template <typename Other>
struct rebind {
- typedef secure_allocator<_Other> other;
+ typedef secure_allocator<Other> other;
};
T* allocate(std::size_t n, const void* hint = nullptr)
diff --git a/src/support/allocators/zeroafterfree.h b/src/support/allocators/zeroafterfree.h
index 795eea3bc0..2dc644c242 100644
--- a/src/support/allocators/zeroafterfree.h
+++ b/src/support/allocators/zeroafterfree.h
@@ -27,9 +27,9 @@ struct zero_after_free_allocator : public std::allocator<T> {
{
}
~zero_after_free_allocator() noexcept {}
- template <typename _Other>
+ template <typename Other>
struct rebind {
- typedef zero_after_free_allocator<_Other> other;
+ typedef zero_after_free_allocator<Other> other;
};
void deallocate(T* p, std::size_t n)
diff --git a/src/test/settings_tests.cpp b/src/test/settings_tests.cpp
index c24921bf9b..eb11df0497 100644
--- a/src/test/settings_tests.cpp
+++ b/src/test/settings_tests.cpp
@@ -35,7 +35,7 @@ inline std::ostream& operator<<(std::ostream& os, const common::SettingsValue& v
inline std::ostream& operator<<(std::ostream& os, const std::pair<std::string, common::SettingsValue>& kv)
{
common::SettingsValue out(common::SettingsValue::VOBJ);
- out.__pushKV(kv.first, kv.second);
+ out.pushKVEnd(kv.first, kv.second);
os << out.write();
return os;
}
diff --git a/src/txorphanage.cpp b/src/txorphanage.cpp
index 19f9fae998..af86baa8ac 100644
--- a/src/txorphanage.cpp
+++ b/src/txorphanage.cpp
@@ -55,10 +55,10 @@ bool TxOrphanage::AddTx(const CTransactionRef& tx, NodeId peer)
int TxOrphanage::EraseTx(const uint256& txid)
{
LOCK(m_mutex);
- return _EraseTx(txid);
+ return EraseTxNoLock(txid);
}
-int TxOrphanage::_EraseTx(const uint256& txid)
+int TxOrphanage::EraseTxNoLock(const uint256& txid)
{
AssertLockHeld(m_mutex);
std::map<uint256, OrphanTx>::iterator it = m_orphans.find(txid);
@@ -103,7 +103,7 @@ void TxOrphanage::EraseForPeer(NodeId peer)
std::map<uint256, OrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
if (maybeErase->second.fromPeer == peer)
{
- nErased += _EraseTx(maybeErase->second.tx->GetHash());
+ nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
}
}
if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer);
@@ -125,7 +125,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
{
std::map<uint256, OrphanTx>::iterator maybeErase = iter++;
if (maybeErase->second.nTimeExpire <= nNow) {
- nErased += _EraseTx(maybeErase->second.tx->GetHash());
+ nErased += EraseTxNoLock(maybeErase->second.tx->GetHash());
} else {
nMinExpTime = std::min(maybeErase->second.nTimeExpire, nMinExpTime);
}
@@ -139,7 +139,7 @@ void TxOrphanage::LimitOrphans(unsigned int max_orphans)
{
// Evict a random orphan:
size_t randompos = rng.randrange(m_orphan_list.size());
- _EraseTx(m_orphan_list[randompos]->first);
+ EraseTxNoLock(m_orphan_list[randompos]->first);
++nEvicted;
}
if (nEvicted > 0) LogPrint(BCLog::MEMPOOL, "orphanage overflow, removed %u tx\n", nEvicted);
@@ -231,7 +231,7 @@ void TxOrphanage::EraseForBlock(const CBlock& block)
if (vOrphanErase.size()) {
int nErased = 0;
for (const uint256& orphanHash : vOrphanErase) {
- nErased += _EraseTx(orphanHash);
+ nErased += EraseTxNoLock(orphanHash);
}
LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx included or conflicted by block\n", nErased);
}
diff --git a/src/txorphanage.h b/src/txorphanage.h
index 45276c6c98..a4705bf382 100644
--- a/src/txorphanage.h
+++ b/src/txorphanage.h
@@ -99,7 +99,7 @@ protected:
std::map<uint256, OrphanMap::iterator> m_wtxid_to_orphan_it GUARDED_BY(m_mutex);
/** Erase an orphan by txid */
- int _EraseTx(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
+ int EraseTxNoLock(const uint256& txid) EXCLUSIVE_LOCKS_REQUIRED(m_mutex);
};
#endif // BITCOIN_TXORPHANAGE_H
diff --git a/src/univalue/include/univalue.h b/src/univalue/include/univalue.h
index 004135ef97..94f80f9c27 100644
--- a/src/univalue/include/univalue.h
+++ b/src/univalue/include/univalue.h
@@ -87,7 +87,7 @@ public:
template <class It>
void push_backV(It first, It last);
- void __pushKV(std::string key, UniValue val);
+ void pushKVEnd(std::string key, UniValue val);
void pushKV(std::string key, UniValue val);
void pushKVs(UniValue obj);
diff --git a/src/univalue/lib/univalue.cpp b/src/univalue/lib/univalue.cpp
index c3d19caae0..656d2e8203 100644
--- a/src/univalue/lib/univalue.cpp
+++ b/src/univalue/lib/univalue.cpp
@@ -115,7 +115,7 @@ void UniValue::push_backV(const std::vector<UniValue>& vec)
values.insert(values.end(), vec.begin(), vec.end());
}
-void UniValue::__pushKV(std::string key, UniValue val)
+void UniValue::pushKVEnd(std::string key, UniValue val)
{
checkType(VOBJ);
@@ -131,7 +131,7 @@ void UniValue::pushKV(std::string key, UniValue val)
if (findKey(key, idx))
values[idx] = std::move(val);
else
- __pushKV(std::move(key), std::move(val));
+ pushKVEnd(std::move(key), std::move(val));
}
void UniValue::pushKVs(UniValue obj)
@@ -140,7 +140,7 @@ void UniValue::pushKVs(UniValue obj)
obj.checkType(VOBJ);
for (size_t i = 0; i < obj.keys.size(); i++)
- __pushKV(std::move(obj.keys.at(i)), std::move(obj.values.at(i)));
+ pushKVEnd(std::move(obj.keys.at(i)), std::move(obj.values.at(i)));
}
void UniValue::getObjMap(std::map<std::string,UniValue>& kv) const
diff --git a/src/univalue/test/object.cpp b/src/univalue/test/object.cpp
index 5fb973c67b..8b90448b36 100644
--- a/src/univalue/test/object.cpp
+++ b/src/univalue/test/object.cpp
@@ -86,7 +86,7 @@ void univalue_push_throw()
UniValue j;
BOOST_CHECK_THROW(j.push_back(1), std::runtime_error);
BOOST_CHECK_THROW(j.push_backV({1}), std::runtime_error);
- BOOST_CHECK_THROW(j.__pushKV("k", 1), std::runtime_error);
+ BOOST_CHECK_THROW(j.pushKVEnd("k", 1), std::runtime_error);
BOOST_CHECK_THROW(j.pushKV("k", 1), std::runtime_error);
BOOST_CHECK_THROW(j.pushKVs({}), std::runtime_error);
}
@@ -364,7 +364,7 @@ void univalue_object()
obj.setObject();
UniValue uv;
uv.setInt(42);
- obj.__pushKV("age", uv);
+ obj.pushKVEnd("age", uv);
BOOST_CHECK_EQUAL(obj.size(), 1);
BOOST_CHECK_EQUAL(obj["age"].getValStr(), "42");
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index 0bd6a9670c..a8ef0a5731 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -677,11 +677,11 @@ RPCHelpMan getaddressesbylabel()
CHECK_NONFATAL(unique);
// UniValue::pushKV checks if the key exists in O(N)
// and since duplicate addresses are unexpected (checked with
- // std::set in O(log(N))), UniValue::__pushKV is used instead,
+ // std::set in O(log(N))), UniValue::pushKVEnd is used instead,
// which currently is O(1).
UniValue value(UniValue::VOBJ);
value.pushKV("purpose", _purpose ? PurposeToString(*_purpose) : "unknown");
- ret.__pushKV(address, value);
+ ret.pushKVEnd(address, value);
}
});