mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix clang warnings
This commit is contained in:
committed by
Vinnie Falco
parent
9bf1a76e91
commit
cd30e552a7
@@ -29,9 +29,8 @@ namespace PeerFinder {
|
||||
class Counts
|
||||
{
|
||||
public:
|
||||
explicit Counts (clock_type& clock)
|
||||
: m_clock (clock)
|
||||
, m_attempts (0)
|
||||
Counts ()
|
||||
: m_attempts (0)
|
||||
, m_active (0)
|
||||
, m_in_max (0)
|
||||
, m_in_active (0)
|
||||
@@ -299,8 +298,6 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
clock_type& m_clock;
|
||||
|
||||
/** Outbound connection attempts. */
|
||||
int m_attempts;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
clock_type& clock,
|
||||
Journal journal)
|
||||
: stopping (false)
|
||||
, counts (clock)
|
||||
, counts ()
|
||||
, livecache (clock, Journal (
|
||||
journal, Reporting::livecache))
|
||||
, bootcache (*store, clock, Journal (
|
||||
|
||||
@@ -201,8 +201,6 @@ public:
|
||||
|
||||
{
|
||||
SharedState::Access state (m_state);
|
||||
Table::iterator iter (
|
||||
state->table.find (*prior.key));
|
||||
std::pair <Table::iterator, bool> result (
|
||||
state->table.emplace (key, 0));
|
||||
entry = &result.first->second;
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
Consumer c (logic.newInboundEndpoint (addr));
|
||||
|
||||
// Create load until we get a warning
|
||||
for (std::size_t n (maxLoopCount); n>=0; --n)
|
||||
for (std::size_t n (maxLoopCount); true; --n)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
}
|
||||
|
||||
// Create load until we get dropped
|
||||
for (std::size_t n (maxLoopCount); n>=0; --n)
|
||||
for (std::size_t n (maxLoopCount); true; --n)
|
||||
{
|
||||
if (n == 0)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
expect (c.disconnect ());
|
||||
}
|
||||
|
||||
for (std::size_t n (maxLoopCount); n>=0; --n)
|
||||
for (std::size_t n (maxLoopCount); true; --n)
|
||||
{
|
||||
Consumer c (logic.newInboundEndpoint (addr));
|
||||
if (n == 0)
|
||||
|
||||
@@ -296,6 +296,15 @@ Status BlockBasedTableBuilder::status() const {
|
||||
return rep_->status;
|
||||
}
|
||||
|
||||
//
|
||||
// Warning: This function is also being used in the file
|
||||
// block_based_table_reader.cc even though it is declared static, due
|
||||
// to the source-file-concatenation build scheme. There is an idential
|
||||
// file-local function in block_based_table_reader.cc too, but it was
|
||||
// not being used.
|
||||
// Do not change this function without reviewing its impact on the code
|
||||
// in block_based_table_reader.cc.
|
||||
//
|
||||
static void DeleteCachedBlock(const Slice& key, void* value) {
|
||||
Block* block = reinterpret_cast<Block*>(value);
|
||||
delete block;
|
||||
|
||||
@@ -166,10 +166,28 @@ void DeleteBlock(void* arg, void* ignored) {
|
||||
delete reinterpret_cast<Block*>(arg);
|
||||
}
|
||||
|
||||
void DeleteCachedBlock(const Slice& key, void* value) {
|
||||
Block* block = reinterpret_cast<Block*>(value);
|
||||
delete block;
|
||||
}
|
||||
//
|
||||
// Commented out DeleteCachedBlock to silence the following warning:
|
||||
//
|
||||
// warning: unused function 'DeleteCachedBlock'
|
||||
//
|
||||
// Although it looks like this function is being used later in this file,
|
||||
// it is not. Instead a file-static function of the same name is being
|
||||
// used from block_based_table_builder.cc. That function is being found
|
||||
// because this file and block_based_table_builder.cc are being
|
||||
// concatenated in ripple_rocksdb.cpp. Fortunately the version of
|
||||
// DeleteCachedBlock in block_based_table_builder.cc is identical to this
|
||||
// one. So everything is working.
|
||||
//
|
||||
// This function has not been removed because it will need to be
|
||||
// uncommented in the event we abandon the source file concatenation build
|
||||
// model. In that event, failure to uncomment this function will lead to a
|
||||
// compile-time error, not a run-time error (so this is safe).
|
||||
//
|
||||
// void DeleteCachedBlock(const Slice& key, void* value) {
|
||||
// Block* block = reinterpret_cast<Block*>(value);
|
||||
// delete block;
|
||||
// }
|
||||
|
||||
void DeleteCachedFilter(const Slice& key, void* value) {
|
||||
auto filter = reinterpret_cast<FilterBlockReader*>(value);
|
||||
|
||||
Reference in New Issue
Block a user