From f40f366e9e84ba1ca645366abcd0b11c8cfc6508 Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Wed, 20 Dec 2017 13:22:38 +0100 Subject: [PATCH] Remove unnecessary inline statements fixes #5886 --- lib/base/array.hpp | 10 ++-- lib/base/convert.hpp | 6 +-- lib/base/dictionary.hpp | 10 ++-- lib/base/function.hpp | 4 +- lib/base/loader.hpp | 4 +- lib/base/logger.hpp | 6 +-- lib/base/objectlock.hpp | 16 +++---- lib/base/scriptframe.hpp | 4 +- lib/base/string.hpp | 96 +++++++++++++++++++-------------------- lib/base/value.hpp | 46 +++++++++---------- lib/config/expression.hpp | 4 +- 11 files changed, 103 insertions(+), 103 deletions(-) diff --git a/lib/base/array.hpp b/lib/base/array.hpp index 682fdfe81..b01a173dd 100644 --- a/lib/base/array.hpp +++ b/lib/base/array.hpp @@ -47,14 +47,14 @@ public: typedef std::vector::size_type SizeType; - inline Array(void) + Array(void) { } - inline Array(std::initializer_list init) + Array(std::initializer_list init) : m_Data(init) { } - inline ~Array(void) + ~Array(void) { } Value Get(SizeType index) const; @@ -70,7 +70,7 @@ public: * * @returns An iterator. */ - inline Iterator Begin(void) + Iterator Begin(void) { ASSERT(OwnsLock()); @@ -84,7 +84,7 @@ public: * * @returns An iterator. */ - inline Iterator End(void) + Iterator End(void) { ASSERT(OwnsLock()); diff --git a/lib/base/convert.hpp b/lib/base/convert.hpp index 5e13a0f96..5eb3d67ba 100644 --- a/lib/base/convert.hpp +++ b/lib/base/convert.hpp @@ -59,17 +59,17 @@ public: } } - static inline long ToLong(const Value& val) + static long ToLong(const Value& val) { return val; } - static inline double ToDouble(const Value& val) + static double ToDouble(const Value& val) { return val; } - static inline bool ToBool(const Value& val) + static bool ToBool(const Value& val) { return val.ToBool(); } diff --git a/lib/base/dictionary.hpp b/lib/base/dictionary.hpp index 298079ba7..05410bea8 100644 --- a/lib/base/dictionary.hpp +++ b/lib/base/dictionary.hpp @@ -49,10 +49,10 @@ public: typedef std::map::value_type Pair; - inline Dictionary(void) + Dictionary(void) { } - inline ~Dictionary(void) + ~Dictionary(void) { } Value Get(const String& key) const; @@ -68,7 +68,7 @@ public: * * @returns An iterator. */ - inline Iterator Begin(void) + Iterator Begin(void) { ASSERT(OwnsLock()); @@ -82,7 +82,7 @@ public: * * @returns An iterator. */ - inline Iterator End(void) + Iterator End(void) { ASSERT(OwnsLock()); @@ -98,7 +98,7 @@ public: * * @param it The iterator. */ - inline void Remove(Iterator it) + void Remove(Iterator it) { ASSERT(OwnsLock()); diff --git a/lib/base/function.hpp b/lib/base/function.hpp index 6dc070080..6922ca1fe 100644 --- a/lib/base/function.hpp +++ b/lib/base/function.hpp @@ -51,12 +51,12 @@ public: Value Invoke(const std::vector& arguments = std::vector()); Value InvokeThis(const Value& otherThis, const std::vector& arguments = std::vector()); - inline bool IsSideEffectFree(void) const + bool IsSideEffectFree(void) const { return GetSideEffectFree(); } - inline bool IsDeprecated(void) const + bool IsDeprecated(void) const { return GetDeprecated(); } diff --git a/lib/base/loader.hpp b/lib/base/loader.hpp index 0a05f6214..e7d9d39d8 100644 --- a/lib/base/loader.hpp +++ b/lib/base/loader.hpp @@ -35,12 +35,12 @@ public: : m_Callback(callback), m_Priority(priority) { } - inline bool operator<(const DeferredInitializer& other) const + bool operator<(const DeferredInitializer& other) const { return m_Priority < other.m_Priority; } - inline void operator()(void) + void operator()(void) { m_Callback(); } diff --git a/lib/base/logger.hpp b/lib/base/logger.hpp index 589c5e0fd..ad16d0d4f 100644 --- a/lib/base/logger.hpp +++ b/lib/base/logger.hpp @@ -109,17 +109,17 @@ I2_BASE_API void IcingaLog(LogSeverity severity, const String& facility, const S class Log { public: - inline Log(LogSeverity severity, const String& facility, const String& message) + Log(LogSeverity severity, const String& facility, const String& message) : m_Severity(severity), m_Facility(facility) { m_Buffer << message; } - inline Log(LogSeverity severity, const String& facility) + Log(LogSeverity severity, const String& facility) : m_Severity(severity), m_Facility(facility) { } - inline ~Log(void) + ~Log(void) { IcingaLog(m_Severity, m_Facility, m_Buffer.str()); } diff --git a/lib/base/objectlock.hpp b/lib/base/objectlock.hpp index 3908d27a4..cc8770923 100644 --- a/lib/base/objectlock.hpp +++ b/lib/base/objectlock.hpp @@ -34,30 +34,30 @@ namespace icinga struct I2_BASE_API ObjectLock { public: - inline ObjectLock(void) + ObjectLock(void) : m_Object(nullptr), m_Locked(false) { } - inline ~ObjectLock(void) + ~ObjectLock(void) { Unlock(); } - inline ObjectLock(const Object::Ptr& object) + ObjectLock(const Object::Ptr& object) : m_Object(object.get()), m_Locked(false) { if (m_Object) Lock(); } - inline ObjectLock(const Object *object) + ObjectLock(const Object *object) : m_Object(object), m_Locked(false) { if (m_Object) Lock(); } - inline static void LockMutex(const Object *object) + static void LockMutex(const Object *object) { unsigned int it = 0; @@ -94,7 +94,7 @@ public: #endif /* _WIN32 */ } - inline void Lock(void) + void Lock(void) { ASSERT(!m_Locked && m_Object); @@ -111,7 +111,7 @@ public: #endif /* I2_DEBUG */ } - inline static void Spin(unsigned int it) + static void Spin(unsigned int it) { if (it < 8) { /* Do nothing. */ @@ -130,7 +130,7 @@ public: } } - inline void Unlock(void) + void Unlock(void) { #ifdef I2_DEBUG if (m_Locked) { diff --git a/lib/base/scriptframe.hpp b/lib/base/scriptframe.hpp index 06fdad0fd..98e54dd3d 100644 --- a/lib/base/scriptframe.hpp +++ b/lib/base/scriptframe.hpp @@ -52,8 +52,8 @@ private: static boost::thread_specific_ptr > m_ScriptFrames; static Array::Ptr m_Imports; - inline static void PushFrame(ScriptFrame *frame); - inline static ScriptFrame *PopFrame(void); + static void PushFrame(ScriptFrame *frame); + static ScriptFrame *PopFrame(void); void InitializeFrame(void); }; diff --git a/lib/base/string.hpp b/lib/base/string.hpp index ae94e952f..961112004 100644 --- a/lib/base/string.hpp +++ b/lib/base/string.hpp @@ -58,23 +58,23 @@ public: typedef std::string::size_type SizeType; - inline String(void) + String(void) : m_Data() { } - inline String(const char *data) + String(const char *data) : m_Data(data) { } - inline String(const std::string& data) + String(const std::string& data) : m_Data(data) { } - inline String(std::string&& data) + String(std::string&& data) : m_Data(data) { } - inline String(String::SizeType n, char c) + String(String::SizeType n, char c) : m_Data(n, c) { } @@ -90,7 +90,7 @@ public: String(Value&& other); #endif /* _MSC_VER */ - inline ~String(void) + ~String(void) { } template @@ -112,35 +112,35 @@ public: String& operator=(Value&& rhs); - inline String& operator=(const std::string& rhs) + String& operator=(const std::string& rhs) { m_Data = rhs; return *this; } - inline String& operator=(const char *rhs) + String& operator=(const char *rhs) { m_Data = rhs; return *this; } - inline const char& operator[](SizeType pos) const + const char& operator[](SizeType pos) const { return m_Data[pos]; } - inline char& operator[](SizeType pos) + char& operator[](SizeType pos) { return m_Data[pos]; } - inline String& operator+=(const String& rhs) + String& operator+=(const String& rhs) { m_Data += rhs.m_Data; return *this; } - inline String& operator+=(const char *rhs) + String& operator+=(const char *rhs) { m_Data += rhs; return *this; @@ -148,153 +148,153 @@ public: String& operator+=(const Value& rhs); - inline String& operator+=(char rhs) + String& operator+=(char rhs) { m_Data += rhs; return *this; } - inline bool IsEmpty(void) const + bool IsEmpty(void) const { return m_Data.empty(); } - inline bool operator<(const String& rhs) const + bool operator<(const String& rhs) const { return m_Data < rhs.m_Data; } - inline operator const std::string&(void) const + operator const std::string&(void) const { return m_Data; } - inline const char *CStr(void) const + const char *CStr(void) const { return m_Data.c_str(); } - inline void Clear(void) + void Clear(void) { m_Data.clear(); } - inline SizeType GetLength(void) const + SizeType GetLength(void) const { return m_Data.size(); } - inline std::string& GetData(void) + std::string& GetData(void) { return m_Data; } - inline const std::string& GetData(void) const + const std::string& GetData(void) const { return m_Data; } - inline SizeType Find(const String& str, SizeType pos = 0) const + SizeType Find(const String& str, SizeType pos = 0) const { return m_Data.find(str, pos); } - inline SizeType RFind(const String& str, SizeType pos = NPos) const + SizeType RFind(const String& str, SizeType pos = NPos) const { return m_Data.rfind(str, pos); } - inline SizeType FindFirstOf(const char *s, SizeType pos = 0) const + SizeType FindFirstOf(const char *s, SizeType pos = 0) const { return m_Data.find_first_of(s, pos); } - inline SizeType FindFirstOf(char ch, SizeType pos = 0) const + SizeType FindFirstOf(char ch, SizeType pos = 0) const { return m_Data.find_first_of(ch, pos); } - inline SizeType FindFirstNotOf(const char *s, SizeType pos = 0) const + SizeType FindFirstNotOf(const char *s, SizeType pos = 0) const { return m_Data.find_first_not_of(s, pos); } - inline SizeType FindFirstNotOf(char ch, SizeType pos = 0) const + SizeType FindFirstNotOf(char ch, SizeType pos = 0) const { return m_Data.find_first_not_of(ch, pos); } - inline SizeType FindLastOf(const char *s, SizeType pos = NPos) const + SizeType FindLastOf(const char *s, SizeType pos = NPos) const { return m_Data.find_last_of(s, pos); } - inline SizeType FindLastOf(char ch, SizeType pos = NPos) const + SizeType FindLastOf(char ch, SizeType pos = NPos) const { return m_Data.find_last_of(ch, pos); } - inline String SubStr(SizeType first, SizeType len = NPos) const + String SubStr(SizeType first, SizeType len = NPos) const { return m_Data.substr(first, len); } - inline std::vector Split(const char *separators) const + std::vector Split(const char *separators) const { std::vector result; boost::algorithm::split(result, m_Data, boost::is_any_of(separators)); return result; } - inline void Replace(SizeType first, SizeType second, const String& str) + void Replace(SizeType first, SizeType second, const String& str) { m_Data.replace(first, second, str); } - inline String Trim(void) const + String Trim(void) const { String t = m_Data; boost::algorithm::trim(t); return t; } - inline String ToLower(void) const + String ToLower(void) const { String t = m_Data; boost::algorithm::to_lower(t); return t; } - inline String ToUpper(void) const + String ToUpper(void) const { String t = m_Data; boost::algorithm::to_upper(t); return t; } - inline String Reverse(void) const + String Reverse(void) const { String t = m_Data; std::reverse(t.m_Data.begin(), t.m_Data.end()); return t; } - inline void Append(int count, char ch) + void Append(int count, char ch) { m_Data.append(count, ch); } - inline bool Contains(const String& str) const + bool Contains(const String& str) const { return (m_Data.find(str) != std::string::npos); } - inline void swap(String& str) + void swap(String& str) { m_Data.swap(str.m_Data); } - inline Iterator erase(Iterator first, Iterator last) + Iterator erase(Iterator first, Iterator last) { return m_Data.erase(first, last); } @@ -305,42 +305,42 @@ public: m_Data.insert(p, first, last); } - inline Iterator Begin(void) + Iterator Begin(void) { return m_Data.begin(); } - inline ConstIterator Begin(void) const + ConstIterator Begin(void) const { return m_Data.begin(); } - inline Iterator End(void) + Iterator End(void) { return m_Data.end(); } - inline ConstIterator End(void) const + ConstIterator End(void) const { return m_Data.end(); } - inline ReverseIterator RBegin(void) + ReverseIterator RBegin(void) { return m_Data.rbegin(); } - inline ConstReverseIterator RBegin(void) const + ConstReverseIterator RBegin(void) const { return m_Data.rbegin(); } - inline ReverseIterator REnd(void) + ReverseIterator REnd(void) { return m_Data.rend(); } - inline ConstReverseIterator REnd(void) const + ConstReverseIterator REnd(void) const { return m_Data.rend(); } diff --git a/lib/base/value.hpp b/lib/base/value.hpp index 996a6a25b..972201ac0 100644 --- a/lib/base/value.hpp +++ b/lib/base/value.hpp @@ -52,53 +52,53 @@ enum ValueType class I2_BASE_API Value { public: - inline Value(void) + Value(void) { } - inline Value(std::nullptr_t) + Value(std::nullptr_t) { } - inline Value(int value) + Value(int value) : m_Value(double(value)) { } - inline Value(unsigned int value) + Value(unsigned int value) : m_Value(double(value)) { } - inline Value(long value) + Value(long value) : m_Value(double(value)) { } - inline Value(unsigned long value) + Value(unsigned long value) : m_Value(double(value)) { } - inline Value(long long value) + Value(long long value) : m_Value(double(value)) { } - inline Value(unsigned long long value) + Value(unsigned long long value) : m_Value(double(value)) { } - inline Value(double value) + Value(double value) : m_Value(value) { } - inline Value(bool value) + Value(bool value) : m_Value(value) { } - inline Value(const String& value) + Value(const String& value) : m_Value(value) { } - inline Value(String&& value) + Value(String&& value) : m_Value(value) { } - inline Value(const char *value) + Value(const char *value) : m_Value(String(value)) { } @@ -115,7 +115,7 @@ public: #endif /* BOOST_VERSION */ } - inline Value(Object *value) + Value(Object *value) { if (!value) return; @@ -124,7 +124,7 @@ public: } template - inline Value(const intrusive_ptr& value) + Value(const intrusive_ptr& value) { if (!value) return; @@ -198,7 +198,7 @@ public: * * @returns true if the variant is empty, false otherwise. */ - inline bool IsEmpty(void) const + bool IsEmpty(void) const { return (GetType() == ValueEmpty || (IsString() && boost::get(m_Value).IsEmpty())); } @@ -208,7 +208,7 @@ public: * * @returns true if the variant is scalar, false otherwise. */ - inline bool IsScalar(void) const + bool IsScalar(void) const { return !IsEmpty() && !IsObject(); } @@ -218,7 +218,7 @@ public: * * @returns true if the variant is a number. */ - inline bool IsNumber(void) const + bool IsNumber(void) const { return (GetType() == ValueNumber); } @@ -228,7 +228,7 @@ public: * * @returns true if the variant is a boolean. */ - inline bool IsBoolean(void) const + bool IsBoolean(void) const { return (GetType() == ValueBoolean); } @@ -238,7 +238,7 @@ public: * * @returns true if the variant is a string. */ - inline bool IsString(void) const + bool IsString(void) const { return (GetType() == ValueString); } @@ -248,7 +248,7 @@ public: * * @returns true if the variant is a non-null object, false otherwise. */ - inline bool IsObject(void) const + bool IsObject(void) const { return (GetType() == ValueObject); } @@ -267,12 +267,12 @@ public: * * @returns The type. */ - inline ValueType GetType(void) const + ValueType GetType(void) const { return static_cast(m_Value.which()); } - inline void Swap(Value& other) + void Swap(Value& other) { m_Value.swap(other.m_Value); } diff --git a/lib/config/expression.hpp b/lib/config/expression.hpp index 46a373556..01d438f13 100644 --- a/lib/config/expression.hpp +++ b/lib/config/expression.hpp @@ -44,12 +44,12 @@ public: : m_Hints(std::move(hints)) { } - inline void AddMessage(const String& message, const DebugInfo& di) + void AddMessage(const String& message, const DebugInfo& di) { GetMessages()->Add(new Array({ message, di.Path, di.FirstLine, di.FirstColumn, di.LastLine, di.LastColumn })); } - inline DebugHint GetChild(const String& name) + DebugHint GetChild(const String& name) { const Dictionary::Ptr& children = GetChildren(); -- 2.40.0