From b4e8f79c5f985a184e1fb35a0aa34de34cc3e921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 9 May 2019 10:43:09 +0300 Subject: [PATCH] Format core sources again Formatted with nl_func_type_name and related options set to ignore. This keeps the formatting intact for long return types in declarations and definitions. --- include/maxscale/buffer.hh | 26 ++-- include/maxscale/config.hh | 20 ++- include/maxscale/config2.hh | 179 +++++++++++++------------ include/maxscale/dcb.hh | 4 +- include/maxscale/mainworker.hh | 7 +- include/maxscale/monitor.hh | 75 +++++------ include/maxscale/mysql_utils.hh | 1 - include/maxscale/pcre2.hh | 5 +- include/maxscale/protocol.hh | 2 +- include/maxscale/query_classifier.hh | 28 ++-- include/maxscale/queryclassifier.hh | 4 +- include/maxscale/router.hh | 8 +- include/maxscale/routingworker.hh | 9 +- include/maxscale/server.hh | 11 +- include/maxscale/service.hh | 6 +- include/maxscale/session.hh | 12 +- include/maxscale/utils.hh | 3 +- server/core/internal/config_runtime.hh | 2 +- server/core/internal/filter.hh | 2 +- server/core/internal/monitor.hh | 36 ++--- server/core/internal/monitormanager.hh | 4 +- server/core/internal/service.hh | 2 +- server/core/session.cc | 2 +- server/core/test/test_config.cc | 20 +-- server/core/test/test_config2.cc | 176 ++++++++++++------------ server/core/test/test_filter.cc | 1 - server/core/test/test_housekeeper.cc | 11 +- server/core/test/test_utils.cc | 1 - server/core/test/test_utils.hh | 2 +- uncrustify.cfg | 6 +- 30 files changed, 331 insertions(+), 334 deletions(-) diff --git a/include/maxscale/buffer.hh b/include/maxscale/buffer.hh index 51c30f391..ace8d6ff3 100644 --- a/include/maxscale/buffer.hh +++ b/include/maxscale/buffer.hh @@ -36,9 +36,9 @@ class Buffer; */ struct BUF_PROPERTY { - char* name; - char* value; - BUF_PROPERTY* next; + char* name; + char* value; + BUF_PROPERTY* next; }; enum gwbuf_type_t @@ -60,7 +60,7 @@ enum gwbuf_type_t #define GWBUF_IS_REPLY_OK(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLY_OK) // True if the query is not initiated by the client but an internal replaying mechanism -#define GWBUF_IS_REPLAYED(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLAYED) +#define GWBUF_IS_REPLAYED(b) ((b)->gwbuf_type & GWBUF_TYPE_REPLAYED) // Track session state change response #define GWBUF_SHOULD_TRACK_STATE(b) ((b)->gwbuf_type & GWBUF_TYPE_TRACK_STATE) @@ -115,15 +115,15 @@ struct SHARED_BUF */ struct GWBUF { - GWBUF* next; /*< Next buffer in a linked chain of buffers */ - GWBUF* tail; /*< Last buffer in a linked chain of buffers */ - void* start; /*< Start of the valid data */ - void* end; /*< First byte after the valid data */ - SHARED_BUF* sbuf; /*< The shared buffer with the real data */ - HINT* hint; /*< Hint data for this buffer */ - BUF_PROPERTY* properties; /*< Buffer properties */ - SERVER* server; /*< The target server where the buffer is executed */ - uint32_t gwbuf_type; /*< buffer's data type information */ + GWBUF* next; /*< Next buffer in a linked chain of buffers */ + GWBUF* tail; /*< Last buffer in a linked chain of buffers */ + void* start; /*< Start of the valid data */ + void* end; /*< First byte after the valid data */ + SHARED_BUF* sbuf; /*< The shared buffer with the real data */ + HINT* hint; /*< Hint data for this buffer */ + BUF_PROPERTY* properties; /*< Buffer properties */ + SERVER* server; /*< The target server where the buffer is executed */ + uint32_t gwbuf_type; /*< buffer's data type information */ #ifdef SS_DEBUG int owner; /*< Owner of the thread, only for debugging */ #endif diff --git a/include/maxscale/config.hh b/include/maxscale/config.hh index 3a937b71b..f5c598e45 100644 --- a/include/maxscale/config.hh +++ b/include/maxscale/config.hh @@ -245,9 +245,7 @@ enum DurationUnit DURATION_IN_MILLISECONDS, DURATION_IN_DEFAULT }; - } - } /** @@ -485,10 +483,10 @@ class CONFIG_CONTEXT public: CONFIG_CONTEXT(const std::string& section = ""); - std::string m_name; /**< The name of the object being configured */ - MXS_CONFIG_PARAMETER m_parameters; /**< The list of parameter values */ - bool m_was_persisted; /**< True if this object was persisted */ - CONFIG_CONTEXT* m_next; /**< Next pointer in the linked list */ + std::string m_name; /**< The name of the object being configured */ + MXS_CONFIG_PARAMETER m_parameters; /**< The list of parameter values */ + bool m_was_persisted; /**< True if this object was persisted */ + CONFIG_CONTEXT* m_next; /**< Next pointer in the linked list */ const char* name() const { @@ -514,11 +512,11 @@ struct MXS_CONFIG int maxlog; /**< Log to MaxScale's own logs */ time_t auth_conn_timeout; /**< Connection timeout for the user * authentication */ - time_t auth_read_timeout; /**< Read timeout for the user authentication */ - time_t auth_write_timeout; /**< Write timeout for the user authentication */ - bool skip_permission_checks; /**< Skip service and monitor permission checks */ - int32_t passive; /**< True if MaxScale is in passive mode */ - int64_t promoted_at; /**< Time when this Maxscale instance was + time_t auth_read_timeout; /**< Read timeout for the user authentication */ + time_t auth_write_timeout; /**< Write timeout for the user authentication */ + bool skip_permission_checks; /**< Skip service and monitor permission checks */ + int32_t passive; /**< True if MaxScale is in passive mode */ + int64_t promoted_at; /**< Time when this Maxscale instance was * promoted from a passive to an active */ char qc_name[PATH_MAX]; /**< The name of the query classifier to load */ char* qc_args; /**< Arguments for the query classifier */ diff --git a/include/maxscale/config2.hh b/include/maxscale/config2.hh index bf401eb72..f3915543a 100644 --- a/include/maxscale/config2.hh +++ b/include/maxscale/config2.hh @@ -44,9 +44,9 @@ public: FILTER }; - using ParamsByName = std::map; + using ParamsByName = std::map; using const_iterator = ParamsByName::const_iterator; - using value_type = ParamsByName::value_type; + using value_type = ParamsByName::value_type; /** * Constructor @@ -291,7 +291,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(value_type value) const; private: @@ -320,7 +321,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(value_type value) const; protected: @@ -403,8 +405,8 @@ private: : ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_COUNT, default_value, min_value >= 0 ? min_value : 0, - max_value <= std::numeric_limits::max() - ? max_value : std::numeric_limits::max()) + max_value <= std::numeric_limits::max() ? + max_value : std::numeric_limits::max()) { mxb_assert(min_value >= 0); mxb_assert(max_value <= std::numeric_limits::max()); @@ -473,10 +475,10 @@ private: value_type max_value) : ParamNumber(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_INT, default_value, - min_value >= std::numeric_limits::min() - ? min_value : std::numeric_limits::min(), - max_value <= std::numeric_limits::max() - ? max_value : std::numeric_limits::max()) + min_value >= std::numeric_limits::min() ? + min_value : std::numeric_limits::min(), + max_value <= std::numeric_limits::max() ? + max_value : std::numeric_limits::max()) { mxb_assert(min_value >= std::numeric_limits::min()); mxb_assert(max_value <= std::numeric_limits::max()); @@ -517,7 +519,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(const value_type& value) const; private: @@ -572,7 +575,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(value_type value) const; void populate(MXS_MODULE_PARAM& param) const; @@ -601,11 +605,11 @@ public: enum Options { - X = MXS_MODULE_OPT_PATH_X_OK, // Execute permission required. - R = MXS_MODULE_OPT_PATH_R_OK, // Read permission required. - W = MXS_MODULE_OPT_PATH_W_OK, // Write permission required. - F = MXS_MODULE_OPT_PATH_F_OK, // File existence required. - C = MXS_MODULE_OPT_PATH_CREAT // Create path if does not exist. + X = MXS_MODULE_OPT_PATH_X_OK, // Execute permission required. + R = MXS_MODULE_OPT_PATH_R_OK, // Read permission required. + W = MXS_MODULE_OPT_PATH_W_OK, // Write permission required. + F = MXS_MODULE_OPT_PATH_F_OK, // File existence required. + C = MXS_MODULE_OPT_PATH_CREAT // Create path if does not exist. }; const uint32_t MASK = X | R | W | F | C; @@ -636,7 +640,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(const value_type& value) const; void populate(MXS_MODULE_PARAM& param) const; @@ -690,15 +695,16 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(value_type value) const; private: ParamSize(Specification* pSpecification, - const char* zName, - const char* zDescription, - Kind kind, - value_type default_value) + const char* zName, + const char* zDescription, + Kind kind, + value_type default_value) : Param(pSpecification, zName, zDescription, kind, MXS_MODULE_PARAM_SIZE) , m_default_value(default_value) { @@ -739,7 +745,8 @@ public: bool set(Type& value, const std::string& value_as_string) const override; - bool from_string(const std::string& value, value_type* pValue, std::string* pMessage = nullptr) const; + bool from_string(const std::string& value, value_type* pValue, + std::string* pMessage = nullptr) const; std::string to_string(value_type value) const; private: @@ -771,9 +778,9 @@ using ParamBitMask = ParamCount; class Configuration { public: - using ValuesByName = std::map; + using ValuesByName = std::map; using const_iterator = ValuesByName::const_iterator; - using value_type = ValuesByName::value_type; + using value_type = ValuesByName::value_type; /** * Constructor @@ -792,7 +799,7 @@ public: * * @return The corresponding @c Value or NULL if @c name is unknown. */ - Type* find_value(const std::string& name); + Type* find_value(const std::string& name); const Type* find_value(const std::string& name) const; /** @@ -818,7 +825,7 @@ public: */ size_t size() const; - /** + /** * @return Const iterator to first parameter. */ const_iterator cbegin() const @@ -856,7 +863,7 @@ class Type { public: Type(const Type& rhs) = delete; - Type& operator = (const Type&) = delete; + Type& operator=(const Type&) = delete; ~Type(); @@ -921,7 +928,7 @@ public: { } - This& operator = (const ConcreteType& rhs) + This& operator=(const ConcreteType& rhs) { // Only the value is copied, the parameter and the configuration // remains the same. @@ -954,43 +961,43 @@ protected: * ConcreteType <-> ConcreteType */ template -inline bool operator == (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator==(const ConcreteType& lhs, + const ConcreteType& rhs) { return lhs.get() == rhs.get(); } template -inline bool operator != (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator!=(const ConcreteType& lhs, + const ConcreteType& rhs) { return lhs.get() != rhs.get(); } template -inline bool operator < (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator<(const ConcreteType& lhs, + const ConcreteType& rhs) { return lhs.get() < rhs.get(); } template -inline bool operator > (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator>(const ConcreteType& lhs, + const ConcreteType& rhs) { return lhs.get() > rhs.get(); } template -inline bool operator <= (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator<=(const ConcreteType& lhs, + const ConcreteType& rhs) { return (lhs.get() < rhs.get()) || (lhs == rhs); } template -inline bool operator >= (const ConcreteType& lhs, - const ConcreteType& rhs) +inline bool operator>=(const ConcreteType& lhs, + const ConcreteType& rhs) { return (lhs.get() > rhs.get()) || (lhs == rhs); } @@ -1001,43 +1008,43 @@ inline bool operator >= (const ConcreteType& lhs, * ConcreteType <-> ParamType::value_type */ template -inline bool operator == (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator==(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return lhs.get() == rhs; } template -inline bool operator != (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator!=(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return lhs.get() != rhs; } template -inline bool operator < (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator<(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return lhs.get() < rhs; } template -inline bool operator > (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator>(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return lhs.get() > rhs; } template -inline bool operator <= (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator<=(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return (lhs.get() < rhs) || (lhs.get() == rhs); } template -inline bool operator >= (const ConcreteType& lhs, - const typename ParamType::value_type& rhs) +inline bool operator>=(const ConcreteType& lhs, + const typename ParamType::value_type& rhs) { return (lhs.get() > rhs) || (lhs.get() == rhs); } @@ -1048,43 +1055,43 @@ inline bool operator >= (const ConcreteType& lhs, * ParamType::value_type <-> ConcreteType */ template -inline bool operator == (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator==(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return lhs == rhs.get(); } template -inline bool operator != (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator!=(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return lhs != rhs.get(); } template -inline bool operator < (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator<(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return lhs < rhs.get(); } template -inline bool operator > (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator>(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return lhs > rhs.get(); } template -inline bool operator <= (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator<=(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return (lhs < rhs.get()) || (lhs == rhs.get()); } template -inline bool operator >= (const typename ParamType::value_type& lhs, - const ConcreteType& rhs) +inline bool operator>=(const typename ParamType::value_type& lhs, + const ConcreteType& rhs) { return (lhs > rhs.get()) || (lhs == rhs.get()); } @@ -1147,11 +1154,11 @@ class Bool : public ConcreteType { public: Bool(Configuration* pConfiguration, const ParamBool* pParam) - : ConcreteType(pConfiguration, pParam) + : ConcreteType(pConfiguration, pParam) { } - explicit operator bool () const + explicit operator bool() const { return m_value; } @@ -1176,18 +1183,18 @@ public: }; /* -template -inline bool operator < (const Duration& lhs, const Duration& rhs) -{ - return lhs.get() < rhs.get(); -} - -template -inline bool operator > (const Duration& lhs, const Duration& rhs) -{ - return lhs.get() > rhs.get(); -} -*/ + * template + * inline bool operator < (const Duration& lhs, const Duration& rhs) + * { + * return lhs.get() < rhs.get(); + * } + * + * template + * inline bool operator > (const Duration& lhs, const Duration& rhs) + * { + * return lhs.get() > rhs.get(); + * } + */ /** * Enum @@ -1230,13 +1237,13 @@ public: class Size : public ConcreteType { public: - Size(Configuration* pConfiguration, const ParamSize* pParam) + Size(Configuration* pConfiguration, const ParamSize* pParam) : ConcreteType(pConfiguration, pParam) { } }; -inline Size::value_type operator / (const Size& lhs, Size::value_type rhs) +inline Size::value_type operator/(const Size& lhs, Size::value_type rhs) { return lhs.get() / rhs; } @@ -1380,7 +1387,7 @@ ParamEnum::ParamEnum(Specification* pSpecification, m_enum_values.emplace_back(x); } - MXS_ENUM_VALUE end { NULL }; + MXS_ENUM_VALUE end {NULL}; m_enum_values.emplace_back(end); } @@ -1446,7 +1453,7 @@ bool ParamEnum::from_string(const std::string& value_as_string, std::string* pMessage) const { auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(), - [value_as_string](const std::pair& elem) { + [value_as_string](const std::pair& elem) { return value_as_string == elem.second; }); @@ -1487,7 +1494,7 @@ template std::string ParamEnum::to_string(value_type value) const { auto it = std::find_if(m_enumeration.begin(), m_enumeration.end(), - [value] (const std::pair& entry) { + [value](const std::pair& entry) { return entry.first == value; }); @@ -1501,6 +1508,4 @@ void ParamEnum::populate(MXS_MODULE_PARAM& param) const param.accepted_values = &m_enum_values[0]; } - } - diff --git a/include/maxscale/dcb.hh b/include/maxscale/dcb.hh index e63658598..f238bd2db 100644 --- a/include/maxscale/dcb.hh +++ b/include/maxscale/dcb.hh @@ -207,8 +207,8 @@ struct DCB : public MXB_POLL_DATA DCB* next = nullptr; /**< Next DCB in owning thread's list */ DCB* tail = nullptr; /**< Last DCB in owning thread's list */ } thread; - uint32_t n_close = 0; /** How many times dcb_close has been called. */ - uint64_t m_uid; /**< Unique identifier for this DCB */ + uint32_t n_close = 0; /** How many times dcb_close has been called. */ + uint64_t m_uid; /**< Unique identifier for this DCB */ }; /** diff --git a/include/maxscale/mainworker.hh b/include/maxscale/mainworker.hh index f3fa19d69..fc1cadbeb 100644 --- a/include/maxscale/mainworker.hh +++ b/include/maxscale/mainworker.hh @@ -54,7 +54,7 @@ public: void add_task(const std::string& name, TASKFN func, void* pData, int frequency); void remove_task(const std::string& name); - void show_tasks(DCB* pDcb) const; + void show_tasks(DCB* pDcb) const; json_t* tasks_to_json(const char* zhost) const; static int64_t ticks(); @@ -75,7 +75,7 @@ private: , nextdue(time(0) + frequency) , id(0) { - }; + } std::string name; TASKFN func; @@ -85,10 +85,9 @@ private: uint32_t id; }; - bool call_task(Worker::Call::action_t action, Task* pTask); + bool call_task(Worker::Call::action_t action, Task* pTask); static bool inc_ticks(Worker::Call::action_t action); std::map m_tasks_by_name; }; - } diff --git a/include/maxscale/monitor.hh b/include/maxscale/monitor.hh index 8584c8775..28c85141b 100644 --- a/include/maxscale/monitor.hh +++ b/include/maxscale/monitor.hh @@ -158,26 +158,26 @@ public: class ConnectionSettings { public: - std::string username; /**< Monitor username */ - std::string password; /**< Monitor password */ - int connect_timeout {1}; /**< Connect timeout in seconds for mysql_real_connect */ - int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server. - * There are retries and the total effective timeout value is two - * times the option value. */ - int read_timeout {1}; /**< Timeout in seconds to read from the server. There are retries - * and the total effective timeout value is three times the - * option value. */ - int connect_attempts {1}; /**< How many times a connection is attempted */ + std::string username; /**< Monitor username */ + std::string password; /**< Monitor password */ + int connect_timeout {1};/**< Connect timeout in seconds for mysql_real_connect */ + int write_timeout {1}; /**< Timeout in seconds for each attempt to write to the server. + * There are retries and the total effective timeout value is two + * times the option value. */ + int read_timeout {1}; /**< Timeout in seconds to read from the server. There are retries + * and the total effective timeout value is three times the + * option value. */ + int connect_attempts {1}; /**< How many times a connection is attempted */ }; /** * Maintenance mode request constants. */ - static const int NO_CHANGE = 0; - static const int MAINT_OFF = 1; - static const int MAINT_ON = 2; + static const int NO_CHANGE = 0; + static const int MAINT_OFF = 1; + static const int MAINT_ON = 2; static const int BEING_DRAINED_OFF = 3; - static const int BEING_DRAINED_ON = 4; + static const int BEING_DRAINED_ON = 4; MonitorServer(SERVER* server, const SERVER::DiskSpaceLimits& monitor_limits); @@ -255,20 +255,20 @@ public: */ void update_disk_space_status(); - SERVER* server = nullptr; /**< The server being monitored */ - MYSQL* con = nullptr; /**< The MySQL connection */ - bool log_version_err = true; - int mon_err_count = 0; + SERVER* server = nullptr; /**< The server being monitored */ + MYSQL* con = nullptr; /**< The MySQL connection */ + bool log_version_err = true; + int mon_err_count = 0; - uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */ - uint64_t pending_status = 0; /**< Status during current monitor loop */ + uint64_t mon_prev_status = -1; /**< Status before starting the current monitor loop */ + uint64_t pending_status = 0; /**< Status during current monitor loop */ - int status_request = NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the - * server? */ + int status_request = NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the + * server? */ private: - const SERVER::DiskSpaceLimits& monitor_limits; /**< Monitor-level disk-space limits */ + const SERVER::DiskSpaceLimits& monitor_limits; /**< Monitor-level disk-space limits */ - bool ok_to_check_disk_space {true}; /**< Set to false if check fails */ + bool ok_to_check_disk_space {true}; /**< Set to false if check fails */ }; /** @@ -281,7 +281,7 @@ public: virtual ~Monitor(); static const int STATUS_FLAG_NOCHECK = 0; - static const int STATUS_FLAG_CHECK = -1; + static const int STATUS_FLAG_CHECK = -1; /** * Ping or connect to a database. If connection does not exist or ping fails, a new connection @@ -419,11 +419,11 @@ public: /** Set when admin requests a maintenance status change. */ int check_status_flag = STATUS_FLAG_NOCHECK; - uint64_t m_ticks {0}; /**< Number of performed monitoring intervals */ - uint8_t m_journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */ + uint64_t m_ticks {0}; /**< Number of performed monitoring intervals */ + uint8_t m_journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */ - MXS_CONFIG_PARAMETER parameters; /**< Configuration parameters */ - std::vector m_servers; /**< Monitored servers */ + MXS_CONFIG_PARAMETER parameters; /**< Configuration parameters */ + std::vector m_servers; /**< Monitored servers */ protected: /** @@ -536,15 +536,15 @@ protected: class Settings { public: - int64_t interval {0}; /**< Monitor interval in milliseconds */ + int64_t interval {0}; /**< Monitor interval in milliseconds */ - std::string script; /**< Script triggered by events */ - int script_timeout {0}; /**< Timeout in seconds for the monitor scripts */ - uint64_t events {0}; /**< Bitfield of events which trigger the script */ + std::string script; /**< Script triggered by events */ + int script_timeout {0}; /**< Timeout in seconds for the monitor scripts */ + uint64_t events {0}; /**< Bitfield of events which trigger the script */ - time_t journal_max_age {0}; /**< Maximum age of journal file */ + time_t journal_max_age {0}; /**< Maximum age of journal file */ - SERVER::DiskSpaceLimits disk_space_limits; /**< Disk space thresholds */ + SERVER::DiskSpaceLimits disk_space_limits; /**< Disk space thresholds */ // How often should a disk space check be made at most. Negative values imply disabling. maxbase::Duration disk_space_check_interval {-1}; @@ -580,7 +580,7 @@ private: int launch_command(MonitorServer* ptr, EXTERNCMD* cmd); FILE* open_data_file(Monitor* monitor, char* path); - int get_data_file_path(char* path) const; + int get_data_file_path(char* path) const; mxb::StopWatch m_disk_space_checked; /**< When was disk space checked the last time */ }; @@ -806,7 +806,7 @@ protected: */ virtual void post_tick(); - MonitorServer* m_master {nullptr}; /**< Master server */ + MonitorServer* m_master {nullptr}; /**< Master server */ private: /** @@ -836,7 +836,6 @@ private: void pre_loop() final; void post_loop() final; - }; /** diff --git a/include/maxscale/mysql_utils.hh b/include/maxscale/mysql_utils.hh index 7496d9151..274fe7453 100644 --- a/include/maxscale/mysql_utils.hh +++ b/include/maxscale/mysql_utils.hh @@ -138,7 +138,6 @@ namespace maxscale */ std::unique_ptr execute_query(MYSQL* conn, const std::string& query, std::string* errmsg_out = NULL); - } MXS_END_DECLS diff --git a/include/maxscale/pcre2.hh b/include/maxscale/pcre2.hh index 15279f98d..5fff87801 100644 --- a/include/maxscale/pcre2.hh +++ b/include/maxscale/pcre2.hh @@ -67,7 +67,8 @@ struct CloserTraits namespace std { -template<> class default_delete +template<> +class default_delete { public: void operator()(pcre2_code* p) @@ -78,6 +79,4 @@ public: } } }; - } - diff --git a/include/maxscale/protocol.hh b/include/maxscale/protocol.hh index df4730e64..68ba3f6ba 100644 --- a/include/maxscale/protocol.hh +++ b/include/maxscale/protocol.hh @@ -137,7 +137,7 @@ struct MXS_PROTOCOL * * @return The name of the default authenticator */ - char* (*auth_default)(); + char* (* auth_default)(); /** * Handle connection limits diff --git a/include/maxscale/query_classifier.hh b/include/maxscale/query_classifier.hh index c6205f7be..4a37dd6c1 100644 --- a/include/maxscale/query_classifier.hh +++ b/include/maxscale/query_classifier.hh @@ -34,8 +34,8 @@ enum qc_init_kind_t */ enum qc_option_t { - QC_OPTION_STRING_ARG_AS_FIELD = (1 << 0), /*< Report a string argument to a function as a field. */ - QC_OPTION_STRING_AS_FIELD = (1 << 1), /*< Report strings as fields. */ + QC_OPTION_STRING_ARG_AS_FIELD = (1 << 0), /*< Report a string argument to a function as a field. */ + QC_OPTION_STRING_AS_FIELD = (1 << 1), /*< Report strings as fields. */ }; const uint32_t QC_OPTION_MASK = QC_OPTION_STRING_ARG_AS_FIELD | QC_OPTION_STRING_AS_FIELD; @@ -144,16 +144,16 @@ enum qc_parse_result_t */ typedef enum qc_field_context { - QC_FIELD_UNION = 1, /** The field appears on the right hand side in a UNION. */ - QC_FIELD_SUBQUERY = 2 /** The field appears in a subquery. */ + QC_FIELD_UNION = 1, /** The field appears on the right hand side in a UNION. */ + QC_FIELD_SUBQUERY = 2 /** The field appears in a subquery. */ } qc_field_context_t; struct QC_FIELD_INFO { - char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */ - char* table; /** Present if the field is of the form "a.b", NULL otherwise. */ - char* column; /** Always present. */ - uint32_t context; /** The context in which the field appears. */ + char* database; /** Present if the field is of the form "a.b.c", NULL otherwise. */ + char* table; /** Present if the field is of the form "a.b", NULL otherwise. */ + char* column; /** Always present. */ + uint32_t context; /** The context in which the field appears. */ }; /** @@ -453,7 +453,7 @@ struct QUERY_CLASSIFIER * * @return The same info that was provided as argument. */ - QC_STMT_INFO* (*qc_info_dup)(QC_STMT_INFO * info); + QC_STMT_INFO* (* qc_info_dup)(QC_STMT_INFO* info); /** * Closes a dupped info object. After the info object has been closed, it must @@ -486,7 +486,7 @@ struct QUERY_CLASSIFIER * * @return The result of the provided info. */ - QC_STMT_RESULT (*qc_get_result_from_info)(const QC_STMT_INFO* info); + QC_STMT_RESULT (* qc_get_result_from_info)(const QC_STMT_INFO* info); }; /** @@ -531,8 +531,8 @@ struct QC_CACHE_STATS */ bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties, qc_sql_mode_t sql_mode, - const char* plugin_name, - const char* plugin_args); + const char* plugin_name, + const char* plugin_args); /** * Loads and setups the default query classifier, and performs @@ -554,8 +554,8 @@ bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties, */ bool qc_init(const QC_CACHE_PROPERTIES* cache_properties, qc_sql_mode_t sql_mode, - const char* plugin_name, - const char* plugin_args); + const char* plugin_name, + const char* plugin_args); /** * Performs thread and process finalization. diff --git a/include/maxscale/queryclassifier.hh b/include/maxscale/queryclassifier.hh index 4a8ee5994..2cb27fcb4 100644 --- a/include/maxscale/queryclassifier.hh +++ b/include/maxscale/queryclassifier.hh @@ -35,7 +35,7 @@ public: public: RouteInfo(); RouteInfo(uint32_t target, - uint8_t command, + uint8_t command, uint32_t type_mask, uint32_t stmt_id); @@ -348,7 +348,7 @@ private: */ bool query_type_is_read_only(uint32_t qtype) const; - void process_routing_hints(HINT* pHints, uint32_t* target); + void process_routing_hints(HINT* pHints, uint32_t* target); uint32_t get_route_target(uint8_t command, uint32_t qtype); MXS_SESSION* session() const diff --git a/include/maxscale/router.hh b/include/maxscale/router.hh index 95838ab3f..70236c575 100644 --- a/include/maxscale/router.hh +++ b/include/maxscale/router.hh @@ -172,7 +172,7 @@ typedef struct mxs_router_object void (* clientReply)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session, GWBUF* queue, - DCB* backend_dcb); + DCB* backend_dcb); /** * @brief Called when a backend DCB has failed @@ -188,7 +188,7 @@ typedef struct mxs_router_object void (* handleError)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session, GWBUF* errmsgbuf, - DCB* backend_dcb, + DCB* backend_dcb, mxs_error_action_t action, bool* succp); @@ -338,7 +338,7 @@ public: * @param pSuccess On output, if false, the session will be terminated. */ void handleError(GWBUF* pMessage, - DCB* pProblem, + DCB* pProblem, mxs_error_action_t action, bool* pSuccess); @@ -479,7 +479,7 @@ public: static void handleError(MXS_ROUTER* pInstance, MXS_ROUTER_SESSION* pData, GWBUF* pMessage, - DCB* pProblem, + DCB* pProblem, mxs_error_action_t action, bool* pSuccess) { diff --git a/include/maxscale/routingworker.hh b/include/maxscale/routingworker.hh index 688c0c45e..6da331e98 100644 --- a/include/maxscale/routingworker.hh +++ b/include/maxscale/routingworker.hh @@ -655,10 +655,11 @@ private: static uint32_t epoll_instance_handler(MXB_POLL_DATA* data, MXB_WORKER* worker, uint32_t events); uint32_t handle_epoll_events(uint32_t events); - static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */ - static maxbase::TimePoint s_watchdog_next_check; /*< Next time to notify systemd. */ - std::atomic m_alive; /*< Set to true in epoll_tick(), false on notification. */ - WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */ + static maxbase::Duration s_watchdog_interval; /*< Duration between notifications, if any. */ + static maxbase::TimePoint s_watchdog_next_check;/*< Next time to notify systemd. */ + std::atomic m_alive; /*< Set to true in epoll_tick(), false on + * notification. */ + WatchdogNotifier* m_pWatchdog_notifier; /*< Watchdog notifier, if systemd enabled. */ }; using WatchdogWorkaround = RoutingWorker::WatchdogWorkaround; diff --git a/include/maxscale/server.hh b/include/maxscale/server.hh index 8e4b2fd9d..6af5a598a 100644 --- a/include/maxscale/server.hh +++ b/include/maxscale/server.hh @@ -202,7 +202,7 @@ public: // Misc fields bool master_err_is_logged = false; /**< If node failed, this indicates whether it is logged. Only * used by rwsplit. TODO: Move to rwsplit */ - bool warn_ssl_not_enabled = true; /**< SSL not used for an SSL enabled server */ + bool warn_ssl_not_enabled = true; /**< SSL not used for an SSL enabled server */ RLagState rlag_state = RLagState::NONE; /**< Is replication lag above or under limit? Used by rwsplit. */ virtual ~SERVER() = default; @@ -520,13 +520,13 @@ public: protected: SERVER() - : m_response_time(maxbase::EMAverage {0.04, 0.35, 500}) + : m_response_time(maxbase::EMAverage {0.04, 0.35, 500}) { } private: - static const int DEFAULT_CHARSET = 0x08; /**< The latin1 charset */ - maxbase::EMAverage m_response_time; /**< Response time calculations for this server */ - std::mutex m_average_write_mutex; /**< Protects response time from concurrent writing */ + static const int DEFAULT_CHARSET = 0x08; /**< The latin1 charset */ + maxbase::EMAverage m_response_time; /**< Response time calculations for this server */ + std::mutex m_average_write_mutex; /**< Protects response time from concurrent writing */ }; namespace maxscale @@ -550,5 +550,4 @@ bool server_set_status(SERVER* server, int bit, std::string* errmsg_out = NULL); * @param errmsg_out Error output */ bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL); - } diff --git a/include/maxscale/service.hh b/include/maxscale/service.hh index 25b5045ff..630f9efee 100644 --- a/include/maxscale/service.hh +++ b/include/maxscale/service.hh @@ -113,7 +113,7 @@ public: bool localhost_match_wildcard_host; /**< Match localhost against wildcard * */ MXS_CONFIG_PARAMETER svc_config_param; /**< list of config params and values */ - int svc_config_version; /**< Version number of configuration + int svc_config_version; /**< Version number of configuration * */ bool svc_do_shutdown; /**< tells the service to exit loops * etc. */ @@ -155,8 +155,8 @@ public: protected: SERVICE(const std::string& name, const std::string& router_name) - : m_name(name) /** Service name. */ - , m_router_name(router_name) /** Router module. */ + : m_name(name) + , m_router_name(router_name) { } diff --git a/include/maxscale/session.hh b/include/maxscale/session.hh index 6f40c8124..79c7eda19 100644 --- a/include/maxscale/session.hh +++ b/include/maxscale/session.hh @@ -504,7 +504,7 @@ uint64_t session_get_current_id(); * @return True, if the variable could be added, false otherwise. */ bool session_add_variable(MXS_SESSION* session, - const char* name, + const char* name, session_variable_handler_t handler, void* context); @@ -524,7 +524,7 @@ bool session_add_variable(MXS_SESSION* session, * @return True, if the variable existed, false otherwise. */ bool session_remove_variable(MXS_SESSION* session, - const char* name, + const char* name, void** context); /** * @brief Set value of maxscale session variable. @@ -542,10 +542,10 @@ bool session_remove_variable(MXS_SESSION* session, * incoming statements. */ char* session_set_variable_value(MXS_SESSION* session, - const char* name_begin, - const char* name_end, - const char* value_begin, - const char* value_end); + const char* name_begin, + const char* name_end, + const char* value_begin, + const char* value_end); /** * @brief Specify how many statements each session should retain for diff --git a/include/maxscale/utils.hh b/include/maxscale/utils.hh index 456c3bf9e..e12eaae1b 100644 --- a/include/maxscale/utils.hh +++ b/include/maxscale/utils.hh @@ -312,7 +312,8 @@ template class EqualPointees : public std::unary_function { public: - EqualPointees(const T& lhs) : m_ppLhs(&lhs) + EqualPointees(const T& lhs) + : m_ppLhs(&lhs) { } bool operator()(const T& pRhs) diff --git a/server/core/internal/config_runtime.hh b/server/core/internal/config_runtime.hh index f4a15adb8..90b73395c 100644 --- a/server/core/internal/config_runtime.hh +++ b/server/core/internal/config_runtime.hh @@ -60,7 +60,7 @@ bool runtime_create_server(const char* name, const char* port, const char* protocol, const char* authenticator, - bool external = true); + bool external = true); /** * @brief Destroy a server diff --git a/server/core/internal/filter.hh b/server/core/internal/filter.hh index e276c7859..011b006da 100644 --- a/server/core/internal/filter.hh +++ b/server/core/internal/filter.hh @@ -50,7 +50,7 @@ SFilterDef filter_alloc(const char* name, const char* module, MXS_CONFIG_PA MXS_DOWNSTREAM* filter_apply(const SFilterDef& filter_def, MXS_SESSION* session, MXS_DOWNSTREAM* downstream); void filter_free(const SFilterDef& filter); int filter_standard_parameter(const char* name); -MXS_UPSTREAM* filter_upstream(const SFilterDef& filter_def, +MXS_UPSTREAM* filter_upstream(const SFilterDef& filter_def, MXS_FILTER_SESSION* fsession, MXS_UPSTREAM* upstream); diff --git a/server/core/internal/monitor.hh b/server/core/internal/monitor.hh index 93637af2c..c73b0e6cb 100644 --- a/server/core/internal/monitor.hh +++ b/server/core/internal/monitor.hh @@ -26,23 +26,23 @@ static const MXS_ENUM_VALUE mxs_monitor_event_default_enum = {"all", ~0ULL}; static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] = { mxs_monitor_event_default_enum, - {"master_down", MASTER_DOWN_EVENT}, - {"master_up", MASTER_UP_EVENT}, - {"slave_down", SLAVE_DOWN_EVENT}, - {"slave_up", SLAVE_UP_EVENT}, - {"server_down", SERVER_DOWN_EVENT}, - {"server_up", SERVER_UP_EVENT}, - {"synced_down", SYNCED_DOWN_EVENT}, - {"synced_up", SYNCED_UP_EVENT}, - {"donor_down", DONOR_DOWN_EVENT}, - {"donor_up", DONOR_UP_EVENT}, - {"lost_master", LOST_MASTER_EVENT}, - {"lost_slave", LOST_SLAVE_EVENT}, - {"lost_synced", LOST_SYNCED_EVENT}, - {"lost_donor", LOST_DONOR_EVENT}, - {"new_master", NEW_MASTER_EVENT}, - {"new_slave", NEW_SLAVE_EVENT}, - {"new_synced", NEW_SYNCED_EVENT}, - {"new_donor", NEW_DONOR_EVENT}, + {"master_down", MASTER_DOWN_EVENT }, + {"master_up", MASTER_UP_EVENT }, + {"slave_down", SLAVE_DOWN_EVENT }, + {"slave_up", SLAVE_UP_EVENT }, + {"server_down", SERVER_DOWN_EVENT }, + {"server_up", SERVER_UP_EVENT }, + {"synced_down", SYNCED_DOWN_EVENT }, + {"synced_up", SYNCED_UP_EVENT }, + {"donor_down", DONOR_DOWN_EVENT }, + {"donor_up", DONOR_UP_EVENT }, + {"lost_master", LOST_MASTER_EVENT }, + {"lost_slave", LOST_SLAVE_EVENT }, + {"lost_synced", LOST_SYNCED_EVENT }, + {"lost_donor", LOST_DONOR_EVENT }, + {"new_master", NEW_MASTER_EVENT }, + {"new_slave", NEW_SLAVE_EVENT }, + {"new_synced", NEW_SYNCED_EVENT }, + {"new_donor", NEW_DONOR_EVENT }, {NULL} }; diff --git a/server/core/internal/monitormanager.hh b/server/core/internal/monitormanager.hh index d1c2e418d..ac6c09521 100644 --- a/server/core/internal/monitormanager.hh +++ b/server/core/internal/monitormanager.hh @@ -150,7 +150,7 @@ class MonitorStop { public: MonitorStop(mxs::Monitor* monitor) - : m_monitor(monitor->state() == MONITOR_STATE_RUNNING ? monitor : nullptr) + : m_monitor(monitor->state() == MONITOR_STATE_RUNNING ? monitor : nullptr) { if (m_monitor) { @@ -168,4 +168,4 @@ public: private: mxs::Monitor* m_monitor; -}; \ No newline at end of file +}; diff --git a/server/core/internal/service.hh b/server/core/internal/service.hh index 91eec4b30..147cd4fbc 100644 --- a/server/core/internal/service.hh +++ b/server/core/internal/service.hh @@ -109,7 +109,7 @@ public: mutable std::mutex lock; // TODO: Make this private. - mxs::Monitor* m_monitor { nullptr }; /**< A possibly associated monitor */ + mxs::Monitor* m_monitor {nullptr}; /**< A possibly associated monitor */ bool uses_cluster() const { diff --git a/server/core/session.cc b/server/core/session.cc index 5740e6bd1..ba521d60a 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -1229,7 +1229,7 @@ void Session::dump_statements() const const QueryInfo& info = *i; GWBUF* pBuffer = info.query().get(); timespec ts = info.time_completed(); - struct tm *tm = localtime(&ts.tv_sec); + struct tm* tm = localtime(&ts.tv_sec); char timestamp[20]; strftime(timestamp, 20, "%Y-%m-%d %H:%M:%S", tm); diff --git a/server/core/test/test_config.cc b/server/core/test/test_config.cc index eaf457522..27506805e 100644 --- a/server/core/test/test_config.cc +++ b/server/core/test/test_config.cc @@ -35,16 +35,16 @@ int test_validity() MXS_MODULE_PARAM params[] = { - {"p1", MXS_MODULE_PARAM_INT, "-123" }, - {"p2", MXS_MODULE_PARAM_COUNT, "123" }, - {"p3", MXS_MODULE_PARAM_BOOL, "true" }, - {"p4", MXS_MODULE_PARAM_STRING, "default" }, - {"p5", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_NONE, enum_values}, - {"p6", MXS_MODULE_PARAM_PATH, "/tmp", MXS_MODULE_OPT_PATH_F_OK}, - {"p7", MXS_MODULE_PARAM_SERVICE, "my-service" }, - {"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values}, - {"p9", MXS_MODULE_PARAM_DURATION, "4711s" }, - {"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S }, + {"p1", MXS_MODULE_PARAM_INT, "-123" }, + {"p2", MXS_MODULE_PARAM_COUNT, "123" }, + {"p3", MXS_MODULE_PARAM_BOOL, "true" }, + {"p4", MXS_MODULE_PARAM_STRING, "default" }, + {"p5", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_NONE, enum_values}, + {"p6", MXS_MODULE_PARAM_PATH, "/tmp", MXS_MODULE_OPT_PATH_F_OK}, + {"p7", MXS_MODULE_PARAM_SERVICE, "my-service" }, + {"p8", MXS_MODULE_PARAM_ENUM, "a", MXS_MODULE_OPT_ENUM_UNIQUE, enum_values}, + {"p9", MXS_MODULE_PARAM_DURATION, "4711s" }, + {"p10", MXS_MODULE_PARAM_DURATION, "4711s", MXS_MODULE_OPT_DURATION_S}, {MXS_END_MODULE_PARAMS} }; diff --git a/server/core/test/test_config2.cc b/server/core/test/test_config2.cc index f849fcc26..345113bc8 100644 --- a/server/core/test/test_config2.cc +++ b/server/core/test/test_config2.cc @@ -22,13 +22,13 @@ using namespace std; -inline ostream& operator << (ostream& out, const std::chrono::seconds& x) +inline ostream& operator<<(ostream& out, const std::chrono::seconds& x) { out << x.count(); return out; } -inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x) +inline ostream& operator<<(ostream& out, const std::chrono::milliseconds& x) { out << x.count(); return out; @@ -37,19 +37,19 @@ inline ostream& operator << (ostream& out, const std::chrono::milliseconds& x) config::Specification specification("test_module", config::Specification::FILTER); config::ParamBool -param_bool(&specification, - "boolean_parameter", - "Specifies whether something is enabled."); + param_bool(&specification, + "boolean_parameter", + "Specifies whether something is enabled."); config::ParamCount -param_count(&specification, - "count_parameter", - "Specifies the cardinality of something."); + param_count(&specification, + "count_parameter", + "Specifies the cardinality of something."); config::ParamInteger -param_integer(&specification, - "integer_parameter", - "Specifies a number."); + param_integer(&specification, + "integer_parameter", + "Specifies a number."); config::ParamDuration param_duration_1(&specification, @@ -73,26 +73,26 @@ config::ParamEnum param_enum(&specification, "enum_parameter", "Specifies a range of values.", - { - { ENUM_ONE, "one" }, - { ENUM_TWO, "two" } - }); +{ + {ENUM_ONE, "one"}, + {ENUM_TWO, "two"} +}); config::ParamPath -param_path(&specification, - "path_parameter", - "Specifies the path of something.", - config::ParamPath::F); + param_path(&specification, + "path_parameter", + "Specifies the path of something.", + config::ParamPath::F); config::ParamSize -param_size(&specification, - "size_parameter", - "Specifies the size of something."); + param_size(&specification, + "size_parameter", + "Specifies the size of something."); config::ParamString -param_string(&specification, - "string_parameter", - "Specifies the name of something."); + param_string(&specification, + "string_parameter", + "Specifies the name of something."); template struct TestEntry @@ -102,7 +102,7 @@ struct TestEntry T value; }; -#define elements_in_array(x) (sizeof(x)/sizeof(x[0])) +#define elements_in_array(x) (sizeof(x) / sizeof(x[0])) template int test(T& value, const TestEntry* pEntries, int nEntries) @@ -151,17 +151,17 @@ int test_bool(config::Bool& value) { static const TestEntry entries[] = { - { "1", true, true }, - { "0", true, false }, - { "true", true, true }, - { "false", true, false }, - { "on", true, true }, - { "off", true, false }, + {"1", true, true }, + {"0", true, false}, + {"true", true, true }, + {"false", true, false}, + {"on", true, true }, + {"off", true, false}, - { "2", false }, - { "truth", false }, - { "%&", false }, - { "-1", false }, + {"2", false}, + {"truth", false}, + {"%&", false}, + {"-1", false}, }; return test(value, entries, elements_in_array(entries)); @@ -171,13 +171,13 @@ int test_count(config::Count& value) { static const TestEntry entries[] = { - { "1", true, 1 }, - { "9999", true, 9999 }, - { "0", true, 0 }, + {"1", true, 1 }, + {"9999", true, 9999}, + {"0", true, 0 }, - { "0x45", false }, - { "blah", false }, - { "-1", false }, + {"0x45", false}, + {"blah", false}, + {"-1", false}, }; return test(value, entries, elements_in_array(entries)); @@ -187,16 +187,16 @@ int test_duration(config::Duration& value) { static const TestEntry::value_type> entries[] = { - { "1", true, std::chrono::seconds { 1 } }, - { "1ms", true, std::chrono::seconds { 0 } }, - { "1s", true, std::chrono::seconds { 1 } }, - { "1m", true, std::chrono::seconds { 60 } }, - { "1h", true, std::chrono::seconds { 3600 } }, + {"1", true, std::chrono::seconds {1 }}, + {"1ms", true, std::chrono::seconds {0 }}, + {"1s", true, std::chrono::seconds {1 }}, + {"1m", true, std::chrono::seconds {60 }}, + {"1h", true, std::chrono::seconds {3600}}, - { "1x", false }, - { "a", false }, - { "-", false }, - { "second", false } + {"1x", false}, + {"a", false}, + {"-", false}, + {"second", false} }; return test(value, entries, elements_in_array(entries)); @@ -206,16 +206,16 @@ int test_duration(config::Duration& value) { static const TestEntry::value_type> entries[] = { - { "1", true, std::chrono::milliseconds { 1 } }, - { "1ms", true, std::chrono::milliseconds { 1 } }, - { "1s", true, std::chrono::milliseconds { 1000 } }, - { "1m", true, std::chrono::milliseconds { 60000 } }, - { "1h", true, std::chrono::milliseconds { 3600000 } }, + {"1", true, std::chrono::milliseconds {1 }}, + {"1ms", true, std::chrono::milliseconds {1 }}, + {"1s", true, std::chrono::milliseconds {1000 }}, + {"1m", true, std::chrono::milliseconds {60000 }}, + {"1h", true, std::chrono::milliseconds {3600000}}, - { "1x", false }, - { "a", false }, - { "-", false }, - { "second", false } + {"1x", false}, + {"a", false}, + {"-", false}, + {"second", false} }; return test(value, entries, elements_in_array(entries)); @@ -225,12 +225,12 @@ int test_enum(config::Enum& value) { static const TestEntry entries[] = { - { "one", true, ENUM_ONE }, - { "two", true, ENUM_TWO }, + {"one", true, ENUM_ONE}, + {"two", true, ENUM_TWO}, - { "blah", false }, - { "1", false }, - { "ones", false } + {"blah", false}, + {"1", false}, + {"ones", false} }; return test(value, entries, elements_in_array(entries)); @@ -243,8 +243,8 @@ int test_path(config::Path& value) static const TestEntry entries[] = { - {strpath, true, strpath}, - {"/tmp", true, "/tmp"}, + {strpath, true, strpath}, + {"/tmp", true, "/tmp" }, {"non-existent", false} }; @@ -256,11 +256,11 @@ int test_size(config::Size& value) { static const TestEntry entries[] = { - { "0", true, 0 }, - { "100", true, 100 }, + {"0", true, 0 }, + {"100", true, 100}, - { "-100", false }, - { "0x100", false }, + {"-100", false}, + {"0x100", false}, }; return test(value, entries, elements_in_array(entries)); @@ -270,13 +270,13 @@ int test_string(config::String& value) { static const TestEntry entries[] = { - { "blah", true, "blah" }, - { "\"blah\"", true, "blah" }, - { "'blah'", true, "blah" }, - { "123", true, "123" }, - { "`blah`", true, "`blah`" }, + {"blah", true, "blah" }, + {"\"blah\"", true, "blah" }, + {"'blah'", true, "blah" }, + {"123", true, "123" }, + {"`blah`", true, "`blah`"}, - { "'blah\"", false } + {"'blah\"", false} }; return test(value, entries, elements_in_array(entries)); @@ -286,15 +286,15 @@ int test_integer(config::Integer& value) { static const TestEntry entries[] = { - { "0", true, 0 }, - { "-1", true, -1 }, - { "1", true, 1 }, - { "-2147483648", true, -2147483648 }, - { "2147483647", true, 2147483647 }, + {"0", true, 0 }, + {"-1", true, -1 }, + {"1", true, 1 }, + {"-2147483648", true, -2147483648}, + {"2147483647", true, 2147483647 }, - { "-2147483649", false }, - { "2147483648", false }, - { "0x10" , false }, + {"-2147483649", false}, + {"2147483648", false}, + {"0x10", false}, }; return test(value, entries, elements_in_array(entries)); @@ -304,9 +304,9 @@ int main() { mxb::Log log; - for_each(specification.cbegin(), specification.cend(),[](const config::Specification::value_type& p) { - cout << p.second->documentation() << endl; - }); + for_each(specification.cbegin(), specification.cend(), [](const config::Specification::value_type& p) { + cout << p.second->documentation() << endl; + }); cout << endl; diff --git a/server/core/test/test_filter.cc b/server/core/test/test_filter.cc index 3a8c69d8e..567713932 100644 --- a/server/core/test/test_filter.cc +++ b/server/core/test/test_filter.cc @@ -42,7 +42,6 @@ namespace { MXS_CONFIG_PARAMETER empty; - } /** * test1 Filter creation, finding and deletion diff --git a/server/core/test/test_housekeeper.cc b/server/core/test/test_housekeeper.cc index ab54e1ec8..b2f15634c 100644 --- a/server/core/test/test_housekeeper.cc +++ b/server/core/test/test_housekeeper.cc @@ -26,29 +26,29 @@ namespace std::atomic n_oneshot; std::atomic n_repeating; -const char* ZONESHOT_NAME = "OneShot"; +const char* ZONESHOT_NAME = "OneShot"; const char* ZREPEATING_NAME = "Repeating"; bool oneshot(void*) { ++n_oneshot; - return false; // Remove from housekeeper. + return false; // Remove from housekeeper. } bool repeating(void*) { ++n_repeating; - return true; // Continue calling. + return true; // Continue calling. } int test() { int rc = EXIT_SUCCESS; - hktask_add(ZONESHOT_NAME, oneshot, nullptr, 1); // Call oneshot, once per second. + hktask_add(ZONESHOT_NAME, oneshot, nullptr, 1); // Call oneshot, once per second. hktask_add(ZREPEATING_NAME, repeating, nullptr, 1); // Call repeating, once per second. - sleep(4); // Should get 1 oneshot call and ~4 repeating calls. + sleep(4); // Should get 1 oneshot call and ~4 repeating calls. hktask_remove(ZREPEATING_NAME); @@ -84,7 +84,6 @@ int test() return rc; } - } int main(int argc, char** argv) diff --git a/server/core/test/test_utils.cc b/server/core/test/test_utils.cc index 9b59f8c70..e1f55ed77 100644 --- a/server/core/test/test_utils.cc +++ b/server/core/test/test_utils.cc @@ -72,7 +72,6 @@ int test_checksums() return 0; } - } int main(int argc, char* argv[]) diff --git a/server/core/test/test_utils.hh b/server/core/test/test_utils.hh index 549cc653c..1fa7b2ae3 100644 --- a/server/core/test/test_utils.hh +++ b/server/core/test/test_utils.hh @@ -40,7 +40,7 @@ void preload_module(const char* name, const char* path, const char* type) set_libdir(MXS_STRDUP(old_libdir.c_str())); } -void init_test_env(char* __attribute((unused)) path = nullptr, uint32_t init_type = QC_INIT_BOTH) +void init_test_env(char* __attribute((unused))path = nullptr, uint32_t init_type = QC_INIT_BOTH) { config_get_global_options()->n_threads = 1; diff --git a/uncrustify.cfg b/uncrustify.cfg index 0400b4b42..7e99d8788 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -1055,11 +1055,11 @@ nl_constr_init_args = add # ignore/add/remove/force nl_enum_own_lines = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition. -nl_func_type_name = remove # ignore/add/remove/force +nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. -nl_func_type_name_class = remove # ignore/add/remove/force +nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between class specification and '::' in 'void A::f() { }' # Only appears in separate member implementation (does not appear with in-line implmementation). @@ -1070,7 +1070,7 @@ nl_func_class_scope = remove # ignore/add/remove/force nl_func_scope_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype. -nl_func_proto_type_name = remove # ignore/add/remove/force +nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the declaration. nl_func_paren = remove # ignore/add/remove/force