Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary inline specifier #1572

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions nano/node/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ class message_header
bool bulk_pull_is_count_present () const;

static std::bitset<16> constexpr block_type_mask = std::bitset<16> (0x0f00);
inline bool valid_magic () const
bool valid_magic () const
{
return magic_number[0] == 'R' && magic_number[1] >= 'A' && magic_number[1] <= 'C';
}
inline bool valid_network () const
bool valid_network () const
{
return (magic_number[1] - 'A') == static_cast<int> (nano::nano_network);
}
Expand All @@ -202,7 +202,7 @@ class message
virtual ~message () = default;
virtual void serialize (nano::stream &) const = 0;
virtual void visit (nano::message_visitor &) const = 0;
virtual inline std::shared_ptr<std::vector<uint8_t>> to_bytes () const
virtual std::shared_ptr<std::vector<uint8_t>> to_bytes () const
{
std::shared_ptr<std::vector<uint8_t>> bytes (new std::vector<uint8_t>);
nano::vectorstream stream (*bytes);
Expand Down
32 changes: 16 additions & 16 deletions nano/node/stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class stat_datapoint
std::chrono::system_clock::time_point timestamp{ std::chrono::system_clock::now () };

/** Add \addend to the current value and optionally update the timestamp */
inline void add (uint64_t addend, bool update_timestamp = true)
void add (uint64_t addend, bool update_timestamp = true)
{
value += addend;
if (update_timestamp)
Expand Down Expand Up @@ -139,7 +139,7 @@ class stat_log_sink
}

/** Returns a reference to the log entry counter */
inline size_t & entries ()
size_t & entries ()
{
return log_entries;
}
Expand Down Expand Up @@ -272,40 +272,40 @@ class stat
* Call this to override the default sample interval and capacity, for a specific stat entry.
* This must be called before any stat entries are added, as part of the node initialiation.
*/
inline void configure (stat::type type, stat::detail detail, stat::dir dir, size_t interval, size_t capacity)
void configure (stat::type type, stat::detail detail, stat::dir dir, size_t interval, size_t capacity)
{
get_entry (key_of (type, detail, dir), interval, capacity);
}

/**
* Disables sampling for a given type/detail/dir combination
*/
inline void disable_sampling (stat::type type, stat::detail detail, stat::dir dir)
void disable_sampling (stat::type type, stat::detail detail, stat::dir dir)
{
auto entry = get_entry (key_of (type, detail, dir));
entry->sample_interval = 0;
}

/** Increments the given counter */
inline void inc (stat::type type, stat::dir dir = stat::dir::in)
void inc (stat::type type, stat::dir dir = stat::dir::in)
{
add (type, dir, 1);
}

/** Increments the counter for \detail, but doesn't update at the type level */
inline void inc_detail_only (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
void inc_detail_only (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
{
add (type, detail, dir, 1);
}

/** Increments the given counter */
inline void inc (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
void inc (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
{
add (type, detail, dir, 1);
}

/** Adds \p value to the given counter */
inline void add (stat::type type, stat::dir dir, uint64_t value)
void add (stat::type type, stat::dir dir, uint64_t value)
{
add (type, detail::all, dir, value);
}
Expand All @@ -320,7 +320,7 @@ class stat
* @param value The amount to add
* @param detail_only If true, only update the detail-level counter
*/
inline void add (stat::type type, stat::detail detail, stat::dir dir, uint64_t value, bool detail_only = false)
void add (stat::type type, stat::detail detail, stat::dir dir, uint64_t value, bool detail_only = false)
{
constexpr uint32_t no_detail_mask = 0xffff00ff;
uint32_t key = key_of (type, detail, dir);
Expand All @@ -340,12 +340,12 @@ class stat
* To avoid recursion, the observer callback must only use the received data point snapshop, not query the stat object.
* @param observer The observer receives a snapshot of the current samples.
*/
inline void observe_sample (stat::type type, stat::detail detail, stat::dir dir, std::function<void(boost::circular_buffer<stat_datapoint> &)> observer)
void observe_sample (stat::type type, stat::detail detail, stat::dir dir, std::function<void(boost::circular_buffer<stat_datapoint> &)> observer)
{
get_entry (key_of (type, detail, dir))->sample_observers.add (observer);
}

inline void observe_sample (stat::type type, stat::dir dir, std::function<void(boost::circular_buffer<stat_datapoint> &)> observer)
void observe_sample (stat::type type, stat::dir dir, std::function<void(boost::circular_buffer<stat_datapoint> &)> observer)
{
observe_sample (type, stat::detail::all, dir, observer);
}
Expand All @@ -355,25 +355,25 @@ class stat
* To avoid recursion, the observer callback must only use the received counts, not query the stat object.
* @param observer The observer receives the old and the new count.
*/
inline void observe_count (stat::type type, stat::detail detail, stat::dir dir, std::function<void(uint64_t, uint64_t)> observer)
void observe_count (stat::type type, stat::detail detail, stat::dir dir, std::function<void(uint64_t, uint64_t)> observer)
{
get_entry (key_of (type, detail, dir))->count_observers.add (observer);
}

/** Returns a potentially empty list of the last N samples, where N is determined by the 'capacity' configuration */
inline boost::circular_buffer<stat_datapoint> * samples (stat::type type, stat::detail detail, stat::dir dir)
boost::circular_buffer<stat_datapoint> * samples (stat::type type, stat::detail detail, stat::dir dir)
{
return &get_entry (key_of (type, detail, dir))->samples;
}

/** Returns current value for the given counter at the type level */
inline uint64_t count (stat::type type, stat::dir dir = stat::dir::in)
uint64_t count (stat::type type, stat::dir dir = stat::dir::in)
{
return count (type, stat::detail::all, dir);
}

/** Returns current value for the given counter at the detail level */
inline uint64_t count (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
uint64_t count (stat::type type, stat::detail detail, stat::dir dir = stat::dir::in)
{
return get_entry (key_of (type, detail, dir))->counter.value;
}
Expand All @@ -396,7 +396,7 @@ class stat
static std::string dir_to_string (uint32_t key);

/** Constructs a key given type, detail and direction. This is used as input to update(...) and get_entry(...) */
inline uint32_t key_of (stat::type type, stat::detail detail, stat::dir dir) const
uint32_t key_of (stat::type type, stat::detail detail, stat::dir dir) const
{
return static_cast<uint8_t> (type) << 16 | static_cast<uint8_t> (detail) << 8 | static_cast<uint8_t> (dir);
}
Expand Down