Collection of minor code improvements.

Program should still behave exactly the same.
This commit is contained in:
eelke 2018-10-21 13:46:58 +02:00
parent 38ae5f50e4
commit d4d8316917
6 changed files with 12 additions and 16 deletions

View file

@ -71,7 +71,7 @@ ExplainRoot::SPtr ExplainRoot::createFromJson(Json::Value &json)
auto res = std::make_shared<ExplainRoot>();
// Explain always seems to be an array with one element
if (json.isArray()) {
if (json.size() > 0) {
if (!json.empty()) {
Json::Value &explain = json[0];
Json::Value &plan = explain["Plan"];
@ -89,7 +89,7 @@ ExplainTreeModelItem::ExplainTreeModelItem() = default;
ExplainTreeModelItem::~ExplainTreeModelItem() = default;
void ExplainTreeModelItem::appendChild(ItemPtr child)
void ExplainTreeModelItem::appendChild(const ItemPtr &child)
{
child->setParent(shared_from_this());
m_childItems.push_back(child);
@ -132,7 +132,7 @@ int ExplainTreeModelItem::row() const
return idx;
}
void ExplainTreeModelItem::setParent(ItemPtr parent)
void ExplainTreeModelItem::setParent(const ItemPtr &parent)
{
m_parentItem = parent;
}
@ -306,7 +306,7 @@ ExplainTreeModelItemPtr ExplainTreeModelItem::parent()
float ExplainTreeModelItem::exclusiveTime() const
{
float tt = inclusiveTime();
for (auto c : m_childItems) {
for (auto&& c : m_childItems) {
tt -= c->inclusiveTime();
}
return tt;