diff options
author | David Robillard <d@drobilla.net> | 2022-06-29 09:44:11 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-07-20 16:24:23 -0400 |
commit | cf72f2855fccaf1c579388bcdba2a219a9983d96 (patch) | |
tree | 8ce97ba5feeb262b77ff77f051e63a2107e0b08a /include/raul | |
parent | d3bb4e9c2dba3cebfa7ce9f37d32e54ec2fe14a3 (diff) | |
download | raul-cf72f2855fccaf1c579388bcdba2a219a9983d96.tar.gz raul-cf72f2855fccaf1c579388bcdba2a219a9983d96.tar.bz2 raul-cf72f2855fccaf1c579388bcdba2a219a9983d96.zip |
Remove redundant inline specifiers
Diffstat (limited to 'include/raul')
-rw-r--r-- | include/raul/Array.hpp | 6 | ||||
-rw-r--r-- | include/raul/DoubleBuffer.hpp | 4 | ||||
-rw-r--r-- | include/raul/Maid.hpp | 11 | ||||
-rw-r--r-- | include/raul/Path.hpp | 25 | ||||
-rw-r--r-- | include/raul/RingBuffer.hpp | 27 | ||||
-rw-r--r-- | include/raul/Semaphore.hpp | 16 | ||||
-rw-r--r-- | include/raul/Symbol.hpp | 8 |
7 files changed, 46 insertions, 51 deletions
diff --git a/include/raul/Array.hpp b/include/raul/Array.hpp index a56ecb4..3c6234c 100644 --- a/include/raul/Array.hpp +++ b/include/raul/Array.hpp @@ -126,15 +126,15 @@ public: } } - inline size_t size() const { return _size; } + size_t size() const { return _size; } - inline T& operator[](size_t i) const + T& operator[](size_t i) const { assert(i < _size); return _elems[i]; } - inline T& at(size_t i) const + T& at(size_t i) const { assert(i < _size); return _elems[i]; diff --git a/include/raul/DoubleBuffer.hpp b/include/raul/DoubleBuffer.hpp index 326b24b..e391bb4 100644 --- a/include/raul/DoubleBuffer.hpp +++ b/include/raul/DoubleBuffer.hpp @@ -39,7 +39,7 @@ public: ~DoubleBuffer() = default; - inline const T& get() const + const T& get() const { switch (_state.load(std::memory_order_acquire)) { case State::READ_WRITE: @@ -52,7 +52,7 @@ public: return _vals[1]; } - inline bool set(T new_val) + bool set(T new_val) { if (transition(State::READ_WRITE, State::READ_LOCK)) { // Locked _vals[1] for writing diff --git a/include/raul/Maid.hpp b/include/raul/Maid.hpp index f50bc24..db957d3 100644 --- a/include/raul/Maid.hpp +++ b/include/raul/Maid.hpp @@ -100,13 +100,10 @@ public: Maid(Maid&&) = delete; Maid& operator=(Maid&&) = delete; - inline ~Maid() { cleanup(); } + ~Maid() { cleanup(); } /// Return false iff there is currently no garbage - inline bool empty() const - { - return !_disposed.load(std::memory_order_relaxed); - } + bool empty() const { return !_disposed.load(std::memory_order_relaxed); } /** Enqueue an object for deletion when cleanup() is called next. @@ -114,7 +111,7 @@ public: This is thread-safe, and real-time safe assuming reasonably low contention. */ - inline void dispose(Disposable* obj) + void dispose(Disposable* obj) { if (obj) { // Atomically add obj to the head of the disposed list @@ -133,7 +130,7 @@ public: Obviously not real-time safe, but may be called while other threads are calling dispose(). */ - inline void cleanup() + void cleanup() { // Atomically get the head of the disposed list Disposable* const disposed = diff --git a/include/raul/Path.hpp b/include/raul/Path.hpp index eddc4f0..acd9e83 100644 --- a/include/raul/Path.hpp +++ b/include/raul/Path.hpp @@ -75,13 +75,13 @@ public: ~Path() = default; /// Return true iff `c` is a valid Path character - static inline bool is_valid_char(char c) + static bool is_valid_char(char c) { return c == '/' || Symbol::is_valid_char(c); } /// Return true iff `str` is a valid Path - static inline bool is_valid(const std::basic_string<char>& str) + static bool is_valid(const std::basic_string<char>& str) { if (str.empty() || (str[0] != '/')) { return false; // Must start with '/' @@ -111,17 +111,17 @@ public: } /// Return true iff this path is the root path ("/") - inline bool is_root() const { return *this == "/"; } + bool is_root() const { return *this == "/"; } /// Return true iff this path is a child of `parent` at any depth - inline bool is_child_of(const Path& parent) const + bool is_child_of(const Path& parent) const { const std::string parent_base = parent.base(); return substr(0, parent_base.length()) == parent_base; } /// Return true iff this path is a parent of `child` at any depth - inline bool is_parent_of(const Path& child) const + bool is_parent_of(const Path& child) const { return child.is_child_of(*this); } @@ -133,7 +133,7 @@ public: for OSC paths, and so on. Since the root path does not have a symbol, this does not return a raul::Symbol but may return the empty string. */ - inline const char* symbol() const + const char* symbol() const { if (!is_root()) { const size_t last_sep = rfind('/'); @@ -150,7 +150,7 @@ public: Calling this on the path "/" will return "/". This is the (deepest) "container path" for OSC paths. */ - inline Path parent() const + Path parent() const { if (is_root()) { return *this; @@ -162,13 +162,13 @@ public: } /// Return a child Path of this path - inline Path child(const Path& p) const + Path child(const Path& p) const { return p.is_root() ? *this : Path(base() + p.substr(1)); } /// Return a direct child Path of this Path with the given Symbol - inline Path child(const raul::Symbol& symbol) const + Path child(const raul::Symbol& symbol) const { return Path(base() + symbol.c_str()); } @@ -179,7 +179,7 @@ public: The returned string is such that appending a valid Symbol to it is guaranteed to form a valid path. */ - inline std::string base() const + std::string base() const { if (is_root()) { return *this; @@ -189,7 +189,7 @@ public: } /// Return the lowest common ancestor of a and b - static inline Path lca(const Path& a, const Path& b) + static Path lca(const Path& a, const Path& b) { const size_t len = std::min(a.length(), b.length()); size_t last_sep = 0; @@ -210,8 +210,7 @@ public: } /// Return true iff `child` is equal to, or a descendant of `parent` - static inline bool descendant_comparator(const Path& parent, - const Path& child) + static bool descendant_comparator(const Path& parent, const Path& child) { return (child == parent || child.is_child_of(parent)); } diff --git a/include/raul/RingBuffer.hpp b/include/raul/RingBuffer.hpp index 829efa3..17ce5f4 100644 --- a/include/raul/RingBuffer.hpp +++ b/include/raul/RingBuffer.hpp @@ -55,35 +55,35 @@ public: This method is NOT thread-safe, it may only be called when there are no readers or writers. */ - inline void reset() + void reset() { _write_head = 0; _read_head = 0; } /// Return the number of bytes of space available for reading - inline uint32_t read_space() const + uint32_t read_space() const { return read_space_internal(_read_head, _write_head); } /// Return the number of bytes of space available for writing - inline uint32_t write_space() const + uint32_t write_space() const { return write_space_internal(_read_head, _write_head); } /// Return the capacity (i.e. total write space when empty) - inline uint32_t capacity() const { return _size - 1; } + uint32_t capacity() const { return _size - 1; } /// Read from the RingBuffer without advancing the read head - inline uint32_t peek(uint32_t size, void* dst) + uint32_t peek(uint32_t size, void* dst) { return peek_internal(_read_head, _write_head, size, dst); } /// Read from the RingBuffer and advance the read head - inline uint32_t read(uint32_t size, void* dst) + uint32_t read(uint32_t size, void* dst) { const uint32_t r = _read_head; const uint32_t w = _write_head; @@ -98,7 +98,7 @@ public: } /// Skip data in the RingBuffer (advance read head without reading) - inline uint32_t skip(uint32_t size) + uint32_t skip(uint32_t size) { const uint32_t r = _read_head; const uint32_t w = _write_head; @@ -112,7 +112,7 @@ public: } /// Write data to the RingBuffer - inline uint32_t write(uint32_t size, const void* src) + uint32_t write(uint32_t size, const void* src) { const uint32_t r = _read_head; const uint32_t w = _write_head; @@ -139,7 +139,7 @@ public: } private: - static inline uint32_t next_power_of_two(uint32_t size) + static uint32_t next_power_of_two(uint32_t size) { // http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 size--; @@ -152,7 +152,7 @@ private: return size; } - inline uint32_t write_space_internal(uint32_t r, uint32_t w) const + uint32_t write_space_internal(uint32_t r, uint32_t w) const { if (r == w) { return _size - 1; @@ -165,7 +165,7 @@ private: return (r - w) - 1; } - inline uint32_t read_space_internal(uint32_t r, uint32_t w) const + uint32_t read_space_internal(uint32_t r, uint32_t w) const { if (r < w) { return w - r; @@ -174,10 +174,7 @@ private: return (w - r + _size) & _size_mask; } - inline uint32_t peek_internal(uint32_t r, - uint32_t w, - uint32_t size, - void* dst) const + uint32_t peek_internal(uint32_t r, uint32_t w, uint32_t size, void* dst) const { if (read_space_internal(r, w) < size) { return 0; diff --git a/include/raul/Semaphore.hpp b/include/raul/Semaphore.hpp index f66bb9d..2cf93db 100644 --- a/include/raul/Semaphore.hpp +++ b/include/raul/Semaphore.hpp @@ -7,7 +7,9 @@ #ifdef __APPLE__ # include <mach/mach.h> #elif defined(_WIN32) -# define NOMINMAX +# ifndef NOMINMAX +# define NOMINMAX +# endif # include <windows.h> #else # include <cerrno> @@ -50,16 +52,16 @@ public: } } - inline Semaphore(const Semaphore&) = delete; - inline Semaphore& operator=(const Semaphore&) = delete; + Semaphore(const Semaphore&) = delete; + Semaphore& operator=(const Semaphore&) = delete; - inline Semaphore(Semaphore&&) = delete; - inline Semaphore& operator=(Semaphore&&) = delete; + Semaphore(Semaphore&&) = delete; + Semaphore& operator=(Semaphore&&) = delete; - inline ~Semaphore() { destroy(); } + ~Semaphore() { destroy(); } /// Destroy and reset to a new initial value - inline void reset(unsigned initial) + void reset(unsigned initial) { destroy(); init(initial); diff --git a/include/raul/Symbol.hpp b/include/raul/Symbol.hpp index 8b8704c..e362f4d 100644 --- a/include/raul/Symbol.hpp +++ b/include/raul/Symbol.hpp @@ -73,19 +73,19 @@ public: ~Symbol() = default; /// Return true iff `c` is a valid Symbol start character - static inline bool is_valid_start_char(char c) + static bool is_valid_start_char(char c) { return (c == '_') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } /// Return true iff `c` is a valid Symbol character - static inline bool is_valid_char(char c) + static bool is_valid_char(char c) { return is_valid_start_char(c) || (c >= '0' && c <= '9'); } /// Return true iff `str` is a valid Symbol - static inline bool is_valid(const std::basic_string<char>& str) + static bool is_valid(const std::basic_string<char>& str) { if (str.empty() || (str[0] >= '0' && str[0] <= '9')) { return false; // Must start with a letter or underscore @@ -100,7 +100,7 @@ public: This will make a best effort at turning `str` into a complete, valid Symbol, and will always return one. */ - static inline Symbol symbolify(const std::basic_string<char>& in) + static Symbol symbolify(const std::basic_string<char>& in) { if (in.empty()) { return Symbol("_"); |