Format core source files

Formatted core .cc files according to current uncrustify configuration.
This commit is contained in:
Markus Mäkelä
2019-05-06 09:10:25 +03:00
parent 5ac24de6b0
commit 6b8ca35408
20 changed files with 307 additions and 301 deletions

View File

@ -23,7 +23,6 @@ static struct ThisUnit
maxscale::MainWorker* pCurrent_main;
int64_t clock_ticks;
} this_unit;
}
namespace maxscale
@ -45,13 +44,13 @@ MainWorker::~MainWorker()
this_unit.pCurrent_main = nullptr;
}
//static
// static
bool MainWorker::created()
{
return this_unit.pCurrent_main ? true : false;
}
//static
// static
MainWorker& MainWorker::get()
{
mxb_assert(this_unit.pCurrent_main);
@ -99,22 +98,22 @@ void MainWorker::show_tasks(DCB* pDcb) const
{
// TODO: Make call() const.
MainWorker* pThis = const_cast<MainWorker*>(this);
pThis->call([this, pDcb] () {
dcb_printf(pDcb, "%-25s | Frequency | Next Due\n", "Name");
dcb_printf(pDcb, "--------------------------+-----------+-------------------------\n");
pThis->call([this, pDcb]() {
dcb_printf(pDcb, "%-25s | Frequency | Next Due\n", "Name");
dcb_printf(pDcb, "--------------------------+-----------+-------------------------\n");
for (auto it = m_tasks_by_name.begin(); it != m_tasks_by_name.end(); ++it)
{
const Task& task = it->second;
for (auto it = m_tasks_by_name.begin(); it != m_tasks_by_name.end(); ++it)
{
const Task& task = it->second;
struct tm tm;
char buf[40];
localtime_r(&task.nextdue, &tm);
asctime_r(&tm, buf);
dcb_printf(pDcb, "%-25s | %-9d | %s", task.name.c_str(), task.frequency, buf);
}
},
EXECUTE_AUTO);
struct tm tm;
char buf[40];
localtime_r(&task.nextdue, &tm);
asctime_r(&tm, buf);
dcb_printf(pDcb, "%-25s | %-9d | %s", task.name.c_str(), task.frequency, buf);
}
},
EXECUTE_AUTO);
}
json_t* MainWorker::tasks_to_json(const char* zHost) const
@ -124,37 +123,37 @@ json_t* MainWorker::tasks_to_json(const char* zHost) const
// TODO: Make call() const.
MainWorker* pThis = const_cast<MainWorker*>(this);
pThis->call([this, zHost, pResult]() {
for (auto it = m_tasks_by_name.begin(); it != m_tasks_by_name.end(); ++it)
{
const Task& task = it->second;
for (auto it = m_tasks_by_name.begin(); it != m_tasks_by_name.end(); ++it)
{
const Task& task = it->second;
struct tm tm;
char buf[40];
localtime_r(&task.nextdue, &tm);
asctime_r(&tm, buf);
char* nl = strchr(buf, '\n');
mxb_assert(nl);
*nl = '\0';
struct tm tm;
char buf[40];
localtime_r(&task.nextdue, &tm);
asctime_r(&tm, buf);
char* nl = strchr(buf, '\n');
mxb_assert(nl);
*nl = '\0';
json_t* pObject = json_object();
json_t* pObject = json_object();
json_object_set_new(pObject, CN_ID, json_string(task.name.c_str()));
json_object_set_new(pObject, CN_TYPE, json_string("tasks"));
json_object_set_new(pObject, CN_ID, json_string(task.name.c_str()));
json_object_set_new(pObject, CN_TYPE, json_string("tasks"));
json_t* pAttrs = json_object();
json_object_set_new(pAttrs, "frequency", json_integer(task.frequency));
json_object_set_new(pAttrs, "next_execution", json_string(buf));
json_t* pAttrs = json_object();
json_object_set_new(pAttrs, "frequency", json_integer(task.frequency));
json_object_set_new(pAttrs, "next_execution", json_string(buf));
json_object_set_new(pObject, CN_ATTRIBUTES, pAttrs);
json_array_append_new(pResult, pObject);
}
},
EXECUTE_AUTO);
json_object_set_new(pObject, CN_ATTRIBUTES, pAttrs);
json_array_append_new(pResult, pObject);
}
},
EXECUTE_AUTO);
return pResult;
}
//static
// static
int64_t MainWorker::ticks()
{
return mxb::atomic::load(&this_unit.clock_ticks, mxb::atomic::RELAXED);
@ -191,7 +190,7 @@ bool MainWorker::call_task(Worker::Call::action_t action, MainWorker::Task* pTas
{
auto it = m_tasks_by_name.find(pTask->name);
if (it != m_tasks_by_name.end()) // Not found, if task function removes task.
if (it != m_tasks_by_name.end()) // Not found, if task function removes task.
{
m_tasks_by_name.erase(it);
}
@ -201,7 +200,7 @@ bool MainWorker::call_task(Worker::Call::action_t action, MainWorker::Task* pTas
return call_again;
}
//static
// static
bool MainWorker::inc_ticks(Worker::Call::action_t action)
{
if (action == Worker::Call::EXECUTE)
@ -211,7 +210,6 @@ bool MainWorker::inc_ticks(Worker::Call::action_t action)
return true;
}
}
extern "C"
@ -241,5 +239,4 @@ int64_t mxs_clock()
{
return mxs::MainWorker::ticks();
}
}