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.
This commit is contained in:
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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}
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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}
|
||||
};
|
||||
|
||||
|
@ -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<std::chrono::seconds>
|
||||
param_duration_1(&specification,
|
||||
@ -73,26 +73,26 @@ config::ParamEnum<Enum>
|
||||
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<class T>
|
||||
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<class T>
|
||||
int test(T& value, const TestEntry<typename T::value_type>* pEntries, int nEntries)
|
||||
@ -151,17 +151,17 @@ int test_bool(config::Bool& value)
|
||||
{
|
||||
static const TestEntry<config::Bool::value_type> 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<config::Count::value_type> 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<std::chrono::seconds>& value)
|
||||
{
|
||||
static const TestEntry<config::Duration<std::chrono::seconds>::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<std::chrono::milliseconds>& value)
|
||||
{
|
||||
static const TestEntry<config::Duration<std::chrono::milliseconds>::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<Enum>& value)
|
||||
{
|
||||
static const TestEntry<Enum> 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<config::Path::value_type> 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<config::Size::value_type> 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<config::String::value_type> 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<config::Integer::value_type> 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;
|
||||
|
||||
|
@ -42,7 +42,6 @@ namespace
|
||||
{
|
||||
|
||||
MXS_CONFIG_PARAMETER empty;
|
||||
|
||||
}
|
||||
/**
|
||||
* test1 Filter creation, finding and deletion
|
||||
|
@ -26,29 +26,29 @@ namespace
|
||||
std::atomic<int> n_oneshot;
|
||||
std::atomic<int> 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)
|
||||
|
@ -72,7 +72,6 @@ int test_checksums()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user