From 75ea1b6ea1cedb3e11912368acb6ede625d38842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 4 Oct 2018 21:40:34 +0300 Subject: [PATCH] Fix formatting of new(std::nothrow) The code previously formatted everything as `new( std::nothrow)`. --- include/maxscale/monitor.hh | 1 - include/maxscale/utils.hh | 1 - .../mxs2043_select_for_update.cpp | 7 ++-- .../mysqlmon_fail_switch_events.cpp | 16 ++++---- maxscale-system-test/testconnections.cpp | 37 ++++++++++--------- maxutils/maxbase/src/log.cc | 2 +- maxutils/maxbase/src/logger.cc | 2 +- maxutils/maxbase/src/messagequeue.cc | 2 +- maxutils/maxbase/src/worker.cc | 2 +- query_classifier/qc_sqlite/qc_sqlite.cc | 2 +- server/core/admin.cc | 4 +- server/core/config.cc | 2 +- server/core/dcb.cc | 4 +- server/core/filter.cc | 2 +- server/core/housekeeper.cc | 2 +- server/core/monitor.cc | 3 +- server/core/query_classifier.cc | 2 +- server/core/resultset.cc | 2 +- server/core/routingworker.cc | 4 +- server/core/server.cc | 4 +- server/core/service.cc | 2 +- server/core/session.cc | 2 +- server/core/users.cc | 2 +- server/core/utils.cc | 1 - .../PAM/PAMAuth/pam_client_session.cc | 2 +- .../authenticator/PAM/PAMAuth/pam_instance.cc | 2 +- .../PAM/PAMBackendAuth/pam_backend_auth.cc | 2 +- .../filter/cache/cachefiltersession.cc | 2 +- server/modules/filter/cache/lrustorage.cc | 2 +- server/modules/filter/cache/rules.cc | 2 +- .../modules/filter/dbfwfilter/dbfwfilter.cc | 6 +-- server/modules/filter/luafilter/luafilter.cc | 2 +- server/modules/filter/qlafilter/qlafilter.cc | 18 ++++----- server/modules/filter/tee/tee.cc | 14 +++---- server/modules/filter/tee/teesession.cc | 2 +- .../mariadbmon/cluster_manipulation.cc | 4 +- .../modules/monitor/mariadbmon/mariadbmon.hh | 14 +++---- .../monitor/mariadbmon/mariadbmon_common.cc | 3 +- .../modules/protocol/MySQL/mariadb_client.cc | 2 +- server/modules/routing/avrorouter/avro.cc | 2 +- .../modules/routing/avrorouter/avro_client.cc | 2 +- .../routing/avrorouter/avro_converter.cc | 2 +- .../modules/routing/avrorouter/avro_main.cc | 2 +- .../modules/routing/avrorouter/avro_schema.cc | 2 +- server/modules/routing/avrorouter/rpl.cc | 18 ++++----- .../routing/readwritesplit/readwritesplit.cc | 2 +- uncrustify.cfg | 4 +- 47 files changed, 109 insertions(+), 110 deletions(-) diff --git a/include/maxscale/monitor.hh b/include/maxscale/monitor.hh index 5908ce7c2..8e4a0e62b 100644 --- a/include/maxscale/monitor.hh +++ b/include/maxscale/monitor.hh @@ -337,5 +337,4 @@ MXS_MONITOR_API MonitorApi::s_api = &MonitorApi::diagnostics, &MonitorApi::diagnostics_json, }; - } diff --git a/include/maxscale/utils.hh b/include/maxscale/utils.hh index 72150e0d1..0fca7639b 100644 --- a/include/maxscale/utils.hh +++ b/include/maxscale/utils.hh @@ -654,5 +654,4 @@ uint64_t get_byteN(const uint8_t* ptr, int bytes); * @return The next byte after the stored value */ uint8_t* set_byteN(uint8_t* ptr, uint64_t value, int bytes); - } diff --git a/maxscale-system-test/mxs2043_select_for_update.cpp b/maxscale-system-test/mxs2043_select_for_update.cpp index 952c91dc3..855ab7971 100644 --- a/maxscale-system-test/mxs2043_select_for_update.cpp +++ b/maxscale-system-test/mxs2043_select_for_update.cpp @@ -36,10 +36,10 @@ namespace { -const char* ZUSER = "mxs2043_user"; +const char* ZUSER = "mxs2043_user"; const char* ZPASSWORD = "mxs2043_user"; -const char* ZTABLE = "test.mxs2043"; -const char* ZCOLUMN = "col"; +const char* ZTABLE = "test.mxs2043"; +const char* ZCOLUMN = "col"; void drop_table(TestConnections& test, MYSQL* pMysql, bool silent = false) { @@ -132,7 +132,6 @@ void run_test(TestConnections& test) mysql_close(pMysql); } } - } int main(int argc, char* argv[]) diff --git a/maxscale-system-test/mysqlmon_fail_switch_events.cpp b/maxscale-system-test/mysqlmon_fail_switch_events.cpp index a3e7e5858..c3fa2b3b1 100644 --- a/maxscale-system-test/mysqlmon_fail_switch_events.cpp +++ b/maxscale-system-test/mysqlmon_fail_switch_events.cpp @@ -65,11 +65,11 @@ void create_event(TestConnections& test) const char create_event_query[] = "CREATE EVENT %s ON SCHEDULE EVERY 1 SECOND " "DO UPDATE test.t1 SET c1 = c1 + 1;"; - if ((test.try_query(conn, EVENT_SHCEDULER, "ON") == 0) && - (test.try_query(conn, "CREATE OR REPLACE TABLE test.t1(c1 INT);") == 0) && - (test.try_query(conn, USE_TEST) == 0) && - (test.try_query(conn, "INSERT INTO t1 VALUES (1);") == 0) && - (test.try_query(conn, create_event_query, EVENT_NAME) == 0)) + if ((test.try_query(conn, EVENT_SHCEDULER, "ON") == 0) + && (test.try_query(conn, "CREATE OR REPLACE TABLE test.t1(c1 INT);") == 0) + && (test.try_query(conn, USE_TEST) == 0) + && (test.try_query(conn, "INSERT INTO t1 VALUES (1);") == 0) + && (test.try_query(conn, create_event_query, EVENT_NAME) == 0)) { test.repl->sync_slaves(); // Check that the event is running and increasing the value @@ -84,9 +84,9 @@ void delete_event(TestConnections& test) test.maxscales->connect_maxscale(0); MYSQL* conn = test.maxscales->conn_rwsplit[0]; - if ((test.try_query(conn, EVENT_SHCEDULER, "OFF") == 0) && - (test.try_query(conn, USE_TEST) == 0) && - (test.try_query(conn, DELETE_EVENT, EVENT_NAME) == 0)) + if ((test.try_query(conn, EVENT_SHCEDULER, "OFF") == 0) + && (test.try_query(conn, USE_TEST) == 0) + && (test.try_query(conn, DELETE_EVENT, EVENT_NAME) == 0)) { test.repl->sync_slaves(); test.expect(!field_is_incrementing(test), diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 48c7d910c..831c6a91b 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -28,7 +28,6 @@ static std::string required_repl_version; static std::string required_galera_version; static bool restart_galera = false; static bool multiple_maxscales = false; - } static void perform_manual_action(const char* zMessage) @@ -131,18 +130,18 @@ TestConnections::TestConnections(int argc, char* argv[]) static struct option long_options[] = { - {"help", no_argument, 0, 'h' }, - {"verbose", no_argument, 0, 'v' }, - {"silent", no_argument, 0, 'n' }, - {"quiet", no_argument, 0, 'q' }, - {"no-maxscale-start", no_argument, 0, 's' }, - {"no-maxscale-init", no_argument, 0, 'i' }, - {"no-nodes-check", no_argument, 0, 'r' }, - {"restart-galera", no_argument, 0, 'g' }, - {"no-timeouts", no_argument, 0, 'z' }, - {"no-galera", no_argument, 0, 'y' }, - {"local-maxscale", optional_argument, 0, 'l' }, - {0, 0, 0, 0 } + {"help", no_argument, 0, 'h' }, + {"verbose", no_argument, 0, 'v' }, + {"silent", no_argument, 0, 'n' }, + {"quiet", no_argument, 0, 'q' }, + {"no-maxscale-start", no_argument, 0, 's' }, + {"no-maxscale-init", no_argument, 0, 'i' }, + {"no-nodes-check", no_argument, 0, 'r' }, + {"restart-galera", no_argument, 0, 'g' }, + {"no-timeouts", no_argument, 0, 'z' }, + {"no-galera", no_argument, 0, 'y' }, + {"local-maxscale", optional_argument, 0, 'l' }, + {0, 0, 0, 0 } }; int c; @@ -212,11 +211,13 @@ TestConnections::TestConnections(int argc, char* argv[]) case 'l': { const char* local_ip = optarg ? optarg : "127.0.0.1"; - printf("MaxScale assumed to be running locally; not started and logs not downloaded. IP: %s\n", local_ip); + printf( + "MaxScale assumed to be running locally; not started and logs not downloaded. IP: %s\n", + local_ip); maxscale_init = false; no_maxscale_log_copy = true; - local_maxscale=true; + local_maxscale = true; setenv("maxscale_IP", local_ip, true); setenv("maxscale_network", local_ip, true); @@ -977,7 +978,8 @@ int TestConnections::start_binlog(int m) if (!local_maxscale) { binlog = - open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password, ssl); + open_conn_no_db(maxscales->binlog_port[m], maxscales->IP[m], repl->user_name, repl->password, + ssl); execute_query(binlog, "stop slave"); execute_query(binlog, "reset slave all"); mysql_close(binlog); @@ -987,7 +989,8 @@ int TestConnections::start_binlog(int m) } else { - perform_manual_action("Perform the equivalent of 'STOP SLAVE; RESET SLAVE ALL' and stop local Maxscale"); + perform_manual_action( + "Perform the equivalent of 'STOP SLAVE; RESET SLAVE ALL' and stop local Maxscale"); } for (i = 0; i < repl->N; i++) diff --git a/maxutils/maxbase/src/log.cc b/maxutils/maxbase/src/log.cc index 3f9345ff9..c80b59f07 100644 --- a/maxutils/maxbase/src/log.cc +++ b/maxutils/maxbase/src/log.cc @@ -482,7 +482,7 @@ bool mxb_log_init(const char* ident, filepath = std::string(logdir) + "/" + suffix; } - this_unit.sMessage_registry.reset(new( std::nothrow) MessageRegistry); + this_unit.sMessage_registry.reset(new(std::nothrow) MessageRegistry); switch (target) { diff --git a/maxutils/maxbase/src/logger.cc b/maxutils/maxbase/src/logger.cc index 807f3f216..f76bc8154 100644 --- a/maxutils/maxbase/src/logger.cc +++ b/maxutils/maxbase/src/logger.cc @@ -108,7 +108,7 @@ std::unique_ptr FileLogger::create(const std::string& filename) if (fd != -1) { - logger.reset(new( std::nothrow) FileLogger(fd, filename)); + logger.reset(new(std::nothrow) FileLogger(fd, filename)); if (logger) { diff --git a/maxutils/maxbase/src/messagequeue.cc b/maxutils/maxbase/src/messagequeue.cc index 69acbba30..0b57fc20e 100644 --- a/maxutils/maxbase/src/messagequeue.cc +++ b/maxutils/maxbase/src/messagequeue.cc @@ -152,7 +152,7 @@ MessageQueue* MessageQueue::create(Handler* pHandler) mxb_strerror(errno)); } #endif - pThis = new( std::nothrow) MessageQueue(pHandler, read_fd, write_fd); + pThis = new(std::nothrow) MessageQueue(pHandler, read_fd, write_fd); if (!pThis) { diff --git a/maxutils/maxbase/src/worker.cc b/maxutils/maxbase/src/worker.cc index 2a93a25dd..b9de4511a 100644 --- a/maxutils/maxbase/src/worker.cc +++ b/maxutils/maxbase/src/worker.cc @@ -487,7 +487,7 @@ bool Worker::execute(function func, mxb::Semaphore* pSem, execute_mode_ }; bool rval = false; - CustomTask* task = new( std::nothrow) CustomTask(func); + CustomTask* task = new(std::nothrow) CustomTask(func); if (task) { diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index 7b4591990..3e576ccde 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -259,7 +259,7 @@ public: static QcSqliteInfo* create(uint32_t collect) { - QcSqliteInfo* pInfo = new( std::nothrow) QcSqliteInfo(collect); + QcSqliteInfo* pInfo = new(std::nothrow) QcSqliteInfo(collect); mxb_assert(pInfo); return pInfo; } diff --git a/server/core/admin.cc b/server/core/admin.cc index 167ae193a..f57cc4cac 100644 --- a/server/core/admin.cc +++ b/server/core/admin.cc @@ -237,7 +237,7 @@ int handle_client(void* cls, { if (*con_cls == NULL) { - if ((*con_cls = new( std::nothrow) Client(connection)) == NULL) + if ((*con_cls = new(std::nothrow) Client(connection)) == NULL) { return MHD_NO; } @@ -335,7 +335,7 @@ static char* load_cert(const char* file) struct stat st; if (stat(file, &st) == 0 - && (rval = new( std::nothrow) char[st.st_size + 1])) + && (rval = new(std::nothrow) char[st.st_size + 1])) { infile.read(rval, st.st_size); rval[st.st_size] = '\0'; diff --git a/server/core/config.cc b/server/core/config.cc index 17c696059..305fb7161 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -472,7 +472,7 @@ static bool duplicate_context_init(DUPLICATE_CONTEXT* context) bool rv = false; const int table_size = 10; - std::set* sections = new( std::nothrow) std::set; + std::set* sections = new(std::nothrow) std::set; int errcode; PCRE2_SIZE erroffset; pcre2_code* re = pcre2_compile((PCRE2_SPTR) "^\\s*\\[(.+)\\]\\s*$", diff --git a/server/core/dcb.cc b/server/core/dcb.cc index ec22f807c..67554e0b8 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -3321,7 +3321,7 @@ static void poll_add_event_to_dcb(DCB* dcb, GWBUF* buf, uint32_t ev) { // ... otherwise we post the fake event using the messaging mechanism. - FakeEventTask* task = new( std::nothrow) FakeEventTask(dcb, buf, ev); + FakeEventTask* task = new(std::nothrow) FakeEventTask(dcb, buf, ev); if (task) { @@ -3530,7 +3530,7 @@ static bool dcb_add_to_worker(Worker* worker, DCB* dcb, uint32_t events) // Otherwise we'll move the whole operation to the correct worker. // This will only happen for "cli" and "maxinfo" services that must // be served by one thread as there otherwise deadlocks can occur. - AddDcbToWorker* task = new( std::nothrow) AddDcbToWorker(dcb, events); + AddDcbToWorker* task = new(std::nothrow) AddDcbToWorker(dcb, events); mxb_assert(task); if (task) diff --git a/server/core/filter.cc b/server/core/filter.cc index 84aef5659..457817c75 100644 --- a/server/core/filter.cc +++ b/server/core/filter.cc @@ -90,7 +90,7 @@ SFilterDef filter_alloc(const char* name, const char* module, MXS_CONFIG_PARAMET return NULL; } - SFilterDef filter(new( std::nothrow) FilterDef(name, module, object, instance, params)); + SFilterDef filter(new(std::nothrow) FilterDef(name, module, object, instance, params)); if (filter) { diff --git a/server/core/housekeeper.cc b/server/core/housekeeper.cc index 9a9a2b2bd..665a51ceb 100644 --- a/server/core/housekeeper.cc +++ b/server/core/housekeeper.cc @@ -134,7 +134,7 @@ Housekeeper::Housekeeper() bool Housekeeper::init() { - hk = new( std::nothrow) Housekeeper; + hk = new(std::nothrow) Housekeeper; return hk != nullptr; } diff --git a/server/core/monitor.cc b/server/core/monitor.cc index a5b892637..e46a86cfa 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -2456,7 +2456,7 @@ bool monitor_set_disk_space_threshold(MXS_MONITOR* monitor, const char* disk_spa { if (!monitor->disk_space_threshold) { - monitor->disk_space_threshold = new( std::nothrow) MxsDiskSpaceThreshold; + monitor->disk_space_threshold = new(std::nothrow) MxsDiskSpaceThreshold; } if (monitor->disk_space_threshold) @@ -2928,5 +2928,4 @@ void MonitorInstance::run_one_tick() mon_hangup_failed_servers(m_monitor); store_server_journal(m_monitor, m_master); } - } diff --git a/server/core/query_classifier.cc b/server/core/query_classifier.cc index 47782e9fc..8adaaaf7c 100644 --- a/server/core/query_classifier.cc +++ b/server/core/query_classifier.cc @@ -530,7 +530,7 @@ bool qc_thread_init(uint32_t kind) if (kind & QC_INIT_SELF) { mxb_assert(!this_thread.pInfo_cache); - this_thread.pInfo_cache = new( std::nothrow) QCInfoCache; + this_thread.pInfo_cache = new(std::nothrow) QCInfoCache; rc = true; } else diff --git a/server/core/resultset.cc b/server/core/resultset.cc index b3a59476b..a8f8c2794 100644 --- a/server/core/resultset.cc +++ b/server/core/resultset.cc @@ -177,7 +177,7 @@ ResultSet::ResultSet(std::initializer_list names) std::unique_ptr ResultSet::create(std::initializer_list names) { - return std::unique_ptr(new( std::nothrow) ResultSet(names)); + return std::unique_ptr(new(std::nothrow) ResultSet(names)); } void ResultSet::add_row(std::initializer_list values) diff --git a/server/core/routingworker.cc b/server/core/routingworker.cc index b013ad4f6..4af207c53 100644 --- a/server/core/routingworker.cc +++ b/server/core/routingworker.cc @@ -187,7 +187,7 @@ bool RoutingWorker::init() if (this_unit.epoll_listener_fd != -1) { int nWorkers = config_threadcount(); - RoutingWorker** ppWorkers = new( std::nothrow) RoutingWorker* [MXS_MAX_THREADS](); // 0-inited + RoutingWorker** ppWorkers = new(std::nothrow) RoutingWorker* [MXS_MAX_THREADS](); // 0-inited // array if (ppWorkers) @@ -489,7 +489,7 @@ void RoutingWorker::post_run() // static RoutingWorker* RoutingWorker::create(int epoll_listener_fd) { - RoutingWorker* pThis = new( std::nothrow) RoutingWorker(); + RoutingWorker* pThis = new(std::nothrow) RoutingWorker(); if (pThis) { diff --git a/server/core/server.cc b/server/core/server.cc index 8d2cea8dd..6b04c9aa1 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -126,7 +126,7 @@ SERVER* server_alloc(const char* name, MXS_CONFIG_PARAMETER* params) return NULL; } - Server* server = new( std::nothrow) Server; + Server* server = new(std::nothrow) Server; char* my_name = MXS_STRDUP(name); char* my_protocol = MXS_STRDUP(protocol); char* my_authenticator = MXS_STRDUP(authenticator); @@ -1519,7 +1519,7 @@ bool server_set_disk_space_threshold(SERVER* server, const char* disk_space_thre { if (!server->disk_space_threshold) { - server->disk_space_threshold = new( std::nothrow) MxsDiskSpaceThreshold; + server->disk_space_threshold = new(std::nothrow) MxsDiskSpaceThreshold; } if (server->disk_space_threshold) diff --git a/server/core/service.cc b/server/core/service.cc index b2d0576d1..406d1da0a 100644 --- a/server/core/service.cc +++ b/server/core/service.cc @@ -93,7 +93,7 @@ Service* service_alloc(const char* name, const char* router, MXS_CONFIG_PARAMETE return NULL; } - Service* service = new( std::nothrow) Service(name, router, params); + Service* service = new(std::nothrow) Service(name, router, params); if (service == nullptr) { diff --git a/server/core/session.cc b/server/core/session.cc index 623317933..8b9e37d9f 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -100,7 +100,7 @@ MXS_SESSION* session_alloc(SERVICE* service, DCB* client_dcb) MXS_SESSION* session_alloc_with_id(SERVICE* service, DCB* client_dcb, uint64_t id) { - Session* session = new( std::nothrow) Session; + Session* session = new(std::nothrow) Session; if (session == nullptr) { diff --git a/server/core/users.cc b/server/core/users.cc index bf06a66e8..beb77dbde 100644 --- a/server/core/users.cc +++ b/server/core/users.cc @@ -248,7 +248,7 @@ private: USERS* users_alloc() { - Users* rval = new( std::nothrow) Users(); + Users* rval = new(std::nothrow) Users(); MXS_OOM_IFNULL(rval); return reinterpret_cast(rval); } diff --git a/server/core/utils.cc b/server/core/utils.cc index 2b9add621..894c35b17 100644 --- a/server/core/utils.cc +++ b/server/core/utils.cc @@ -1292,5 +1292,4 @@ size_t header_callback(char* ptr, size_t size, size_t nmemb, void* userdata) return nmemb * size; } } - } diff --git a/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc b/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc index e30d31d9b..ebab8df20 100644 --- a/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc +++ b/server/modules/authenticator/PAM/PAMAuth/pam_client_session.cc @@ -243,7 +243,7 @@ PamClientSession* PamClientSession::create(const PamInstance& inst) MXS_ERROR("Failed to open SQLite3 handle."); } PamClientSession* rval = NULL; - if (!dbhandle || (rval = new( std::nothrow) PamClientSession(dbhandle, inst)) == NULL) + if (!dbhandle || (rval = new(std::nothrow) PamClientSession(dbhandle, inst)) == NULL) { sqlite3_close_v2(dbhandle); } diff --git a/server/modules/authenticator/PAM/PAMAuth/pam_instance.cc b/server/modules/authenticator/PAM/PAMAuth/pam_instance.cc index 85f58f97f..5dc2e8c77 100644 --- a/server/modules/authenticator/PAM/PAMAuth/pam_instance.cc +++ b/server/modules/authenticator/PAM/PAMAuth/pam_instance.cc @@ -67,7 +67,7 @@ PamInstance* PamInstance::create(char** options) PamInstance* instance = NULL; if (!error - && ((instance = new( std::nothrow) PamInstance(dbhandle, pam_db_name, pam_table_name)) == NULL)) + && ((instance = new(std::nothrow) PamInstance(dbhandle, pam_db_name, pam_table_name)) == NULL)) { sqlite3_close_v2(dbhandle); } diff --git a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc index d565548e9..de6dd51e5 100644 --- a/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc +++ b/server/modules/authenticator/PAM/PAMBackendAuth/pam_backend_auth.cc @@ -21,7 +21,7 @@ static void* pam_backend_auth_alloc(void* instance) { - PamBackendSession* pses = new( std::nothrow) PamBackendSession(); + PamBackendSession* pses = new(std::nothrow) PamBackendSession(); return pses; } diff --git a/server/modules/filter/cache/cachefiltersession.cc b/server/modules/filter/cache/cachefiltersession.cc index 8e2cbad1e..9cbf3c8eb 100644 --- a/server/modules/filter/cache/cachefiltersession.cc +++ b/server/modules/filter/cache/cachefiltersession.cc @@ -265,7 +265,7 @@ CacheFilterSession* CacheFilterSession::Create(Cache* pCache, MXS_SESSION* pSess if ((zDb[0] == 0) || zDefaultDb) { - pCacheFilterSession = new( std::nothrow) CacheFilterSession(pSession, pCache, zDefaultDb); + pCacheFilterSession = new(std::nothrow) CacheFilterSession(pSession, pCache, zDefaultDb); if (!pCacheFilterSession) { diff --git a/server/modules/filter/cache/lrustorage.cc b/server/modules/filter/cache/lrustorage.cc index 6cf719039..149c2d66a 100644 --- a/server/modules/filter/cache/lrustorage.cc +++ b/server/modules/filter/cache/lrustorage.cc @@ -558,7 +558,7 @@ cache_result_t LRUStorage::get_new_node(const CACHE_KEY& key, } else { - pNode = new( std::nothrow) Node; + pNode = new(std::nothrow) Node; } if (pNode) diff --git a/server/modules/filter/cache/rules.cc b/server/modules/filter/cache/rules.cc index 86aa0afbc..4a72c60c5 100644 --- a/server/modules/filter/cache/rules.cc +++ b/server/modules/filter/cache/rules.cc @@ -435,7 +435,7 @@ std::auto_ptr CacheRules::create(uint32_t debug) if (pRules) { - sThis = std::auto_ptr(new( std::nothrow) CacheRules(pRules)); + sThis = std::auto_ptr(new(std::nothrow) CacheRules(pRules)); } return sThis; diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.cc b/server/modules/filter/dbfwfilter/dbfwfilter.cc index 0406a54bc..84bbc597f 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.cc +++ b/server/modules/filter/dbfwfilter/dbfwfilter.cc @@ -487,7 +487,7 @@ static int dbfw_thr_init() mxb_assert(this_thread == NULL); int rval = 0; - if ((this_thread = new( std::nothrow) DbfwThread) == NULL) + if ((this_thread = new(std::nothrow) DbfwThread) == NULL) { MXS_OOM(); rval = -1; @@ -1227,7 +1227,7 @@ Dbfw* Dbfw::create(const char* zName, MXS_CONFIG_PARAMETER* pParams) if (process_rule_file(file, &rules, &users)) { - rval = new( std::nothrow) Dbfw(pParams); + rval = new(std::nothrow) Dbfw(pParams); } return rval; @@ -1235,7 +1235,7 @@ Dbfw* Dbfw::create(const char* zName, MXS_CONFIG_PARAMETER* pParams) DbfwSession* Dbfw::newSession(MXS_SESSION* session) { - return new( std::nothrow) DbfwSession(this, session); + return new(std::nothrow) DbfwSession(this, session); } fw_actions Dbfw::get_action() const diff --git a/server/modules/filter/luafilter/luafilter.cc b/server/modules/filter/luafilter/luafilter.cc index 3319acf06..afb2ca11c 100644 --- a/server/modules/filter/luafilter/luafilter.cc +++ b/server/modules/filter/luafilter/luafilter.cc @@ -249,7 +249,7 @@ void expose_functions(lua_State* state, GWBUF** active_buffer) */ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params) { - LUA_INSTANCE* my_instance = new( std::nothrow) LUA_INSTANCE; + LUA_INSTANCE* my_instance = new(std::nothrow) LUA_INSTANCE; if (my_instance == NULL) { diff --git a/server/modules/filter/qlafilter/qlafilter.cc b/server/modules/filter/qlafilter/qlafilter.cc index a3eca15c0..ab157e8f6 100644 --- a/server/modules/filter/qlafilter/qlafilter.cc +++ b/server/modules/filter/qlafilter/qlafilter.cc @@ -480,7 +480,7 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params { // The instance is allocated before opening the file since open_log_file() takes the instance as a // parameter. Will be fixed (or at least cleaned) with a later refactoring of functions/methods. - my_instance = new( std::nothrow) QlaInstance(name, params); + my_instance = new(std::nothrow) QlaInstance(name, params); if (my_instance) { my_instance->re_match = re_match; @@ -592,14 +592,14 @@ static MXS_FILTER_SESSION* newSession(MXS_FILTER* instance, MXS_SESSION* session QlaFilterSession* my_session = NULL; if (!error) { - my_session = new( std::nothrow) QlaFilterSession(userName, - remote, - ses_active, - mdata, - filename, - session_file, - session->ses_id, - session->service->name); + my_session = new(std::nothrow) QlaFilterSession(userName, + remote, + ses_active, + mdata, + filename, + session_file, + session->ses_id, + session->service->name); if (my_session == NULL) { error = true; diff --git a/server/modules/filter/tee/tee.cc b/server/modules/filter/tee/tee.cc index cd15c4f55..218ad4233 100644 --- a/server/modules/filter/tee/tee.cc +++ b/server/modules/filter/tee/tee.cc @@ -74,13 +74,13 @@ Tee* Tee::create(const char* name, MXS_CONFIG_PARAMETER* params) const char* match_str = config_get_string(params, "match"); const char* exclude_str = config_get_string(params, "exclude"); - Tee* my_instance = new( std::nothrow) Tee(service, - source, - user, - match, - match_str, - exclude, - exclude_str); + Tee* my_instance = new(std::nothrow) Tee(service, + source, + user, + match, + match_str, + exclude, + exclude_str); if (my_instance == NULL) { diff --git a/server/modules/filter/tee/teesession.cc b/server/modules/filter/tee/teesession.cc index 243b70247..347ebd6be 100644 --- a/server/modules/filter/tee/teesession.cc +++ b/server/modules/filter/tee/teesession.cc @@ -67,7 +67,7 @@ TeeSession* TeeSession::create(Tee* my_instance, MXS_SESSION* session) } } - TeeSession* tee = new( std::nothrow) TeeSession(session, client, match, md_match, exclude, md_exclude); + TeeSession* tee = new(std::nothrow) TeeSession(session, client, match, md_match, exclude, md_exclude); if (!tee) { diff --git a/server/modules/monitor/mariadbmon/cluster_manipulation.cc b/server/modules/monitor/mariadbmon/cluster_manipulation.cc index dea091ac9..ac50c3485 100644 --- a/server/modules/monitor/mariadbmon/cluster_manipulation.cc +++ b/server/modules/monitor/mariadbmon/cluster_manipulation.cc @@ -849,8 +849,8 @@ bool MariaDBMonitor::failover_perform(ClusterOperation& op) * once so that latest status is printed. */ wait_cluster_stabilization(op, redirected_slaves); MXS_INFO("Failover: slave replication confirmation took %.1f seconds with " - "%.1f seconds to spare.", - timer.lap().secs(), op.time_remaining.secs()); + "%.1f seconds to spare.", + timer.lap().secs(), op.time_remaining.secs()); } } return rval; diff --git a/server/modules/monitor/mariadbmon/mariadbmon.hh b/server/modules/monitor/mariadbmon/mariadbmon.hh index a6e355aa5..0f4e46d4d 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.hh +++ b/server/modules/monitor/mariadbmon/mariadbmon.hh @@ -265,17 +265,17 @@ private: const MariaDBServer* demotion_target, uint32_t gtid_domain, std::string* reason_out = NULL); - int redirect_slaves(MariaDBServer* new_master, - const ServerArray& slaves, - ServerArray* redirected_slaves); + int redirect_slaves(MariaDBServer* new_master, + const ServerArray& slaves, + ServerArray* redirected_slaves); int redirect_slaves_ex(ClusterOperation& op, const ServerArray& slaves, ServerArray* redirected_slaves); std::string generate_change_master_cmd(const std::string& master_host, int master_port); bool start_external_replication(MariaDBServer* new_master, json_t** err_out); - void wait_cluster_stabilization(ClusterOperation& op, const ServerArray& slaves); - void report_and_disable(const std::string& operation, - const std::string& setting_name, - bool* setting_var); + void wait_cluster_stabilization(ClusterOperation& op, const ServerArray& slaves); + void report_and_disable(const std::string& operation, + const std::string& setting_name, + bool* setting_var); bool check_gtid_replication(Log log_mode, const MariaDBServer* demotion_target, json_t** error_out); diff --git a/server/modules/monitor/mariadbmon/mariadbmon_common.cc b/server/modules/monitor/mariadbmon/mariadbmon_common.cc index 573229e71..fbd0e0730 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon_common.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon_common.cc @@ -50,4 +50,5 @@ ClusterOperation::ClusterOperation(OperationType type, , replication_password(replication_password) , error_out(error) , time_remaining(time_remaining) -{} +{ +} diff --git a/server/modules/protocol/MySQL/mariadb_client.cc b/server/modules/protocol/MySQL/mariadb_client.cc index 3d1146fdc..5a52ecbde 100644 --- a/server/modules/protocol/MySQL/mariadb_client.cc +++ b/server/modules/protocol/MySQL/mariadb_client.cc @@ -237,7 +237,7 @@ LocalClient* LocalClient::create(MYSQL_session* session, MySQLProtocol* proto, c if (fd > 0 && (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) == 0 || errno == EINPROGRESS)) { - LocalClient* relay = new( std::nothrow) LocalClient(session, proto, fd); + LocalClient* relay = new(std::nothrow) LocalClient(session, proto, fd); if (relay) { diff --git a/server/modules/routing/avrorouter/avro.cc b/server/modules/routing/avrorouter/avro.cc index 2ef7fd79c..42a9f6fa8 100644 --- a/server/modules/routing/avrorouter/avro.cc +++ b/server/modules/routing/avrorouter/avro.cc @@ -125,7 +125,7 @@ Avro* Avro::create(SERVICE* service, SRowEventHandler handler) } } - return new( std::nothrow) Avro(service, service->svc_config_param, source_service, handler); + return new(std::nothrow) Avro(service, service->svc_config_param, source_service, handler); } Avro::Avro(SERVICE* service, MXS_CONFIG_PARAMETER* params, SERVICE* source, SRowEventHandler handler) diff --git a/server/modules/routing/avrorouter/avro_client.cc b/server/modules/routing/avrorouter/avro_client.cc index 11123a1f7..1329e3634 100644 --- a/server/modules/routing/avrorouter/avro_client.cc +++ b/server/modules/routing/avrorouter/avro_client.cc @@ -740,7 +740,7 @@ void AvroSession::client_callback() // static AvroSession* AvroSession::create(Avro* inst, MXS_SESSION* session) { - return new( std::nothrow) AvroSession(inst, session); + return new(std::nothrow) AvroSession(inst, session); } AvroSession::AvroSession(Avro* instance, MXS_SESSION* session) diff --git a/server/modules/routing/avrorouter/avro_converter.cc b/server/modules/routing/avrorouter/avro_converter.cc index 14037fb0a..7b90d5de5 100644 --- a/server/modules/routing/avrorouter/avro_converter.cc +++ b/server/modules/routing/avrorouter/avro_converter.cc @@ -74,7 +74,7 @@ AvroTable* avro_table_alloc(const char* filepath, return NULL; } - AvroTable* table = new( std::nothrow) AvroTable(avro_file, avro_writer_iface, avro_schema); + AvroTable* table = new(std::nothrow) AvroTable(avro_file, avro_writer_iface, avro_schema); if (!table) { diff --git a/server/modules/routing/avrorouter/avro_main.cc b/server/modules/routing/avrorouter/avro_main.cc index 3d0830bc2..9745c8c87 100644 --- a/server/modules/routing/avrorouter/avro_main.cc +++ b/server/modules/routing/avrorouter/avro_main.cc @@ -341,7 +341,7 @@ static bool conversion_task_ctl(Avro* inst, bool start) if (!maxscale_is_shutting_down()) { Worker* worker = static_cast(mxs_rworker_get(MXS_RWORKER_MAIN)); - std::unique_ptr task(new( std::nothrow) ConversionCtlTask(inst, start)); + std::unique_ptr task(new(std::nothrow) ConversionCtlTask(inst, start)); if (task.get()) { diff --git a/server/modules/routing/avrorouter/avro_schema.cc b/server/modules/routing/avrorouter/avro_schema.cc index c64d45368..e0e95eff9 100644 --- a/server/modules/routing/avrorouter/avro_schema.cc +++ b/server/modules/routing/avrorouter/avro_schema.cc @@ -147,7 +147,7 @@ TableCreateEvent* table_create_from_schema(const char* file, if (json_extract_field_names(file, columns)) { - newtable = new( std::nothrow) TableCreateEvent(db, table, version, std::move(columns)); + newtable = new(std::nothrow) TableCreateEvent(db, table, version, std::move(columns)); } return newtable; diff --git a/server/modules/routing/avrorouter/rpl.cc b/server/modules/routing/avrorouter/rpl.cc index cc1240591..66a50d76c 100644 --- a/server/modules/routing/avrorouter/rpl.cc +++ b/server/modules/routing/avrorouter/rpl.cc @@ -541,7 +541,7 @@ STableCreateEvent table_create_alloc(char* ident, const char* sql, int len) if (!columns.empty()) { int version = resolve_table_version(database, table); - rval.reset(new( std::nothrow) TableCreateEvent(database, table, version, std::move(columns))); + rval.reset(new(std::nothrow) TableCreateEvent(database, table, version, std::move(columns))); } else { @@ -600,13 +600,13 @@ TableMapEvent* table_map_alloc(uint8_t* ptr, uint8_t hdr_len, TableCreateEvent* Bytes cols(column_types, column_types + column_count); Bytes nulls(nullmap, nullmap + nullmap_size); Bytes meta(metadata, metadata + metadata_size); - return new( std::nothrow) TableMapEvent(schema_name, - table_name, - table_id, - create->version, - std::move(cols), - std::move(nulls), - std::move(meta)); + return new(std::nothrow) TableMapEvent(schema_name, + table_name, + table_id, + create->version, + std::move(cols), + std::move(nulls), + std::move(meta)); } Rpl::Rpl(SERVICE* service, @@ -864,7 +864,7 @@ STableCreateEvent Rpl::table_create_copy(const char* sql, size_t len, const char if (it != m_created_tables.end()) { - rval.reset(new( std::nothrow) TableCreateEvent(*it->second)); + rval.reset(new(std::nothrow) TableCreateEvent(*it->second)); char* table = strchr(target, '.'); table = table ? table + 1 : target; rval->table = table; diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 3ddc14ca8..ffae857c4 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -250,7 +250,7 @@ RWSplit* RWSplit::create(SERVICE* service, MXS_CONFIG_PARAMETER* params) config.master_reconnection = true; } - return new( std::nothrow) RWSplit(service, config); + return new(std::nothrow) RWSplit(service, config); } RWSplitSession* RWSplit::newSession(MXS_SESSION* session) diff --git a/uncrustify.cfg b/uncrustify.cfg index eab4c6ac2..b92f76baa 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -532,11 +532,11 @@ sp_between_new_paren = remove # ignore/add/remove/force sp_after_newop_paren = force # ignore/add/remove/force # Controls the spaces inside paren of the new operator: 'new(foo) BAR'. -sp_inside_newop_paren = ignore # ignore/add/remove/force +sp_inside_newop_paren = remove # ignore/add/remove/force # Controls the space after open paren of the new operator: 'new(foo) BAR'. # Overrides sp_inside_newop_paren. -sp_inside_newop_paren_open = force # ignore/add/remove/force +sp_inside_newop_paren_open = ignore # ignore/add/remove/force # Controls the space before close paren of the new operator: 'new(foo) BAR'. # Overrides sp_inside_newop_paren.