mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-23 17:57:54 +02:00
Replace some insert/push_back
expr with emplace/emplace_back
This commit is contained in:
parent
52b1b7ead3
commit
d8445ca41a
@ -131,7 +131,7 @@ static Array::Ptr ArrayMap(const Function::Ptr& function)
|
|||||||
|
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
for (const Value& item : self) {
|
for (const Value& item : self) {
|
||||||
result.push_back(function->Invoke({ item }));
|
result.emplace_back(function->Invoke({ item }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Array(std::move(result));
|
return new Array(std::move(result));
|
||||||
|
@ -262,7 +262,7 @@ Object::Ptr Array::Clone() const
|
|||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
for (const Value& val : m_Data) {
|
for (const Value& val : m_Data) {
|
||||||
arr.push_back(val.Clone());
|
arr.emplace_back(val.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Array(std::move(arr));
|
return new Array(std::move(arr));
|
||||||
|
@ -63,7 +63,7 @@ static Array::Ptr NamespaceValues()
|
|||||||
ArrayData values;
|
ArrayData values;
|
||||||
ObjectLock olock(self);
|
ObjectLock olock(self);
|
||||||
for (const Namespace::Pair& kv : self) {
|
for (const Namespace::Pair& kv : self) {
|
||||||
values.push_back(kv.second.Val);
|
values.emplace_back(kv.second.Val);
|
||||||
}
|
}
|
||||||
return new Array(std::move(values));
|
return new Array(std::move(values));
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ Array::Ptr ScriptUtils::GetTemplates(const Type::Ptr& type)
|
|||||||
|
|
||||||
for (const ConfigItem::Ptr& item : ConfigItem::GetItems(type)) {
|
for (const ConfigItem::Ptr& item : ConfigItem::GetItems(type)) {
|
||||||
if (item->IsAbstract())
|
if (item->IsAbstract())
|
||||||
result.push_back(GetTargetForTemplate(item));
|
result.emplace_back(GetTargetForTemplate(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Array(std::move(result));
|
return new Array(std::move(result));
|
||||||
|
@ -41,7 +41,7 @@ std::vector<String> icinga::GetBashCompletionSuggestions(const String& type, con
|
|||||||
if (lstat(path.CStr(), &statbuf) >= 0) {
|
if (lstat(path.CStr(), &statbuf) >= 0) {
|
||||||
if (S_ISDIR(statbuf.st_mode)) {
|
if (S_ISDIR(statbuf.st_mode)) {
|
||||||
result.clear(),
|
result.clear(),
|
||||||
result.push_back(path + "/");
|
result.emplace_back(path + "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
|
|||||||
else if (!vm.count("no-config")) {
|
else if (!vm.count("no-config")) {
|
||||||
/* The implicit string assignment is needed for Windows builds. */
|
/* The implicit string assignment is needed for Windows builds. */
|
||||||
String configDir = Configuration::ConfigDir;
|
String configDir = Configuration::ConfigDir;
|
||||||
configs.push_back(configDir + "/icinga2.conf");
|
configs.emplace_back(configDir + "/icinga2.conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vm.count("dump-objects")) {
|
if (vm.count("dump-objects")) {
|
||||||
|
@ -422,7 +422,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
for (const ConfigItem::Ptr& item : m_UnnamedItems) {
|
for (const ConfigItem::Ptr& item : m_UnnamedItems) {
|
||||||
if (item->m_ActivationContext != context) {
|
if (item->m_ActivationContext != context) {
|
||||||
newUnnamedItems.push_back(item);
|
newUnnamedItems.emplace_back(item);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
for (const Type::Ptr& type : Type::GetAllTypes()) {
|
||||||
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
|
if (ConfigObject::TypeInstance->IsAssignableFrom(type))
|
||||||
types.insert(type);
|
types.emplace(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (types.size() != completed_types.size()) {
|
while (types.size() != completed_types.size()) {
|
||||||
@ -507,7 +507,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
itemsCount += committed_items;
|
itemsCount += committed_items;
|
||||||
|
|
||||||
completed_types.insert(type);
|
completed_types.emplace(type);
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
if (committed_items > 0)
|
if (committed_items > 0)
|
||||||
@ -571,7 +571,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(item->m_Mutex);
|
std::unique_lock<std::mutex> lock(item->m_Mutex);
|
||||||
item->m_IgnoredItems.push_back(item->m_DebugInfo.Path);
|
item->m_IgnoredItems.emplace_back(item->m_DebugInfo.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -580,7 +580,7 @@ bool ConfigItem::CommitNewItems(const ActivationContext::Ptr& context, WorkQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
completed_types.insert(type);
|
completed_types.emplace(type);
|
||||||
|
|
||||||
#ifdef I2_DEBUG
|
#ifdef I2_DEBUG
|
||||||
if (notified_items > 0)
|
if (notified_items > 0)
|
||||||
|
@ -45,7 +45,7 @@ Value MacroProcessor::ResolveMacros(const Value& str, const ResolverList& resolv
|
|||||||
EscapeCallback(), resolvedMacros, useResolvedMacros, recursionLevel + 1);
|
EscapeCallback(), resolvedMacros, useResolvedMacros, recursionLevel + 1);
|
||||||
|
|
||||||
if (value.IsObjectType<Array>())
|
if (value.IsObjectType<Array>())
|
||||||
resultArr.push_back(Utility::Join(value, ';'));
|
resultArr.emplace_back(Utility::Join(value, ';'));
|
||||||
else
|
else
|
||||||
resultArr.push_back(value);
|
resultArr.push_back(value);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ bool DeleteObjectHandler::HandleRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryDescription qd;
|
QueryDescription qd;
|
||||||
qd.Types.insert(type->GetName());
|
qd.Types.emplace(type->GetName());
|
||||||
qd.Permission = "objects/delete/" + type->GetName();
|
qd.Permission = "objects/delete/" + type->GetName();
|
||||||
|
|
||||||
params->Set("type", type->GetName());
|
params->Set("type", type->GetName());
|
||||||
|
@ -39,7 +39,7 @@ bool ModifyObjectHandler::HandleRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryDescription qd;
|
QueryDescription qd;
|
||||||
qd.Types.insert(type->GetName());
|
qd.Types.emplace(type->GetName());
|
||||||
qd.Permission = "objects/modify/" + type->GetName();
|
qd.Permission = "objects/modify/" + type->GetName();
|
||||||
|
|
||||||
params->Set("type", type->GetName());
|
params->Set("type", type->GetName());
|
||||||
|
@ -115,7 +115,7 @@ bool ObjectQueryHandler::HandleRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryDescription qd;
|
QueryDescription qd;
|
||||||
qd.Types.insert(type->GetName());
|
qd.Types.emplace(type->GetName());
|
||||||
qd.Permission = "objects/query/" + type->GetName();
|
qd.Permission = "objects/query/" + type->GetName();
|
||||||
|
|
||||||
Array::Ptr uattrs, ujoins, umetas;
|
Array::Ptr uattrs, ujoins, umetas;
|
||||||
@ -174,7 +174,7 @@ bool ObjectQueryHandler::HandleRequest(
|
|||||||
if (ujoins) {
|
if (ujoins) {
|
||||||
ObjectLock olock(ujoins);
|
ObjectLock olock(ujoins);
|
||||||
for (const String& ujoin : ujoins) {
|
for (const String& ujoin : ujoins) {
|
||||||
userJoinAttrs.insert(ujoin.SubStr(0, ujoin.FindFirstOf(".")));
|
userJoinAttrs.emplace(ujoin.SubStr(0, ujoin.FindFirstOf(".")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ bool TemplateQueryHandler::HandleRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryDescription qd;
|
QueryDescription qd;
|
||||||
qd.Types.insert(type->GetName());
|
qd.Types.emplace(type->GetName());
|
||||||
qd.Permission = "templates/query/" + type->GetName();
|
qd.Permission = "templates/query/" + type->GetName();
|
||||||
qd.Provider = new TemplateTargetProvider();
|
qd.Provider = new TemplateTargetProvider();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user