From 592d1c7d7e7f65d8b686e52f5e65c2f143499f2c Mon Sep 17 00:00:00 2001 From: Michael Insel Date: Mon, 12 Mar 2018 20:23:21 +0100 Subject: [PATCH] Replace std::vector:push_back with initializer list This replaces a few std::vector::push_back calls with initializer lists. --- lib/cli/nodesetupcommand.cpp | 10 ++-------- lib/cli/nodewizardcommand.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/cli/nodesetupcommand.cpp b/lib/cli/nodesetupcommand.cpp index 859a58d78..bd7d7d409 100644 --- a/lib/cli/nodesetupcommand.cpp +++ b/lib/cli/nodesetupcommand.cpp @@ -158,15 +158,12 @@ int NodeSetupCommand::SetupMaster(const boost::program_options::variables_map& v /* write zones.conf and update with zone + endpoint information */ Log(LogInformation, "cli", "Generating zone and object configuration."); - std::vector globalZones; + std::vector globalZones { "global-templates", "director-global" }; std::vector setupGlobalZones; if (vm.count("global_zones")) setupGlobalZones = vm["global_zones"].as >(); - globalZones.push_back("global-templates"); - globalZones.push_back("director-global"); - for (int i = 0; i < setupGlobalZones.size(); i++) { if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) { Log(LogCritical, "cli") @@ -429,15 +426,12 @@ int NodeSetupCommand::SetupNode(const boost::program_options::variables_map& vm, Log(LogInformation, "cli", "Generating zone and object configuration."); - std::vector globalZones; + std::vector globalZones { "global-templates", "director-global" }; std::vector setupGlobalZones; if (vm.count("global_zones")) setupGlobalZones = vm["global_zones"].as >(); - globalZones.push_back("global-templates"); - globalZones.push_back("director-global"); - for (int i = 0; i < setupGlobalZones.size(); i++) { if (std::find(globalZones.begin(), globalZones.end(), setupGlobalZones[i]) != globalZones.end()) { Log(LogCritical, "cli") diff --git a/lib/cli/nodewizardcommand.cpp b/lib/cli/nodewizardcommand.cpp index b08dcbc31..07a743c85 100644 --- a/lib/cli/nodewizardcommand.cpp +++ b/lib/cli/nodewizardcommand.cpp @@ -499,10 +499,7 @@ wizard_ticket: /* apilistener config */ Log(LogInformation, "cli", "Generating local zones.conf."); - std::vector globalZones; - - globalZones.push_back("global-templates"); - globalZones.push_back("director-global"); + std::vector globalZones { "global-templates", "director-global" }; std::cout << "\nDo you want to specify additional global zones? [y/N]: "; @@ -633,10 +630,7 @@ int NodeWizardCommand::MasterSetup() const else std::cout << "'api' feature already enabled.\n"; - std::vector globalZones; - - globalZones.push_back("global-templates"); - globalZones.push_back("director-global"); + std::vector globalZones { "global-templates", "director-global" }; std::cout << "\nDo you want to specify additional global zones? [y/N]: "; -- 2.40.0