From 01565540f1e39584fb5714d4f4c361ff518917f1 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 2 Oct 2020 23:39:42 +0200 Subject: [PATCH] [sonar] Use "std::make_shared" to construct "std::shared_ptr". --- include/simgrid/kernel/future.hpp | 4 ++-- src/mc/checker/LivenessChecker.cpp | 2 +- src/smpi/internals/smpi_replay.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 906d702937..b41008eb64 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -485,7 +485,7 @@ public: } private: - std::shared_ptr> state_{new FutureState()}; + std::shared_ptr> state_ = std::make_shared>(); bool future_get_ = false; }; @@ -536,7 +536,7 @@ public: } private: - std::shared_ptr> state_{new FutureState()}; + std::shared_ptr> state_ = std::make_shared>(); bool future_get_ = false; }; diff --git a/src/mc/checker/LivenessChecker.cpp b/src/mc/checker/LivenessChecker.cpp index e22741d715..37bf22227e 100644 --- a/src/mc/checker/LivenessChecker.cpp +++ b/src/mc/checker/LivenessChecker.cpp @@ -266,7 +266,7 @@ std::shared_ptr LivenessChecker::create_pair(const Pair* current_pair, xbt expanded_pairs_count_++; std::shared_ptr next_pair = std::make_shared(expanded_pairs_count_); next_pair->automaton_state = state; - next_pair->graph_state = std::shared_ptr(new State(++expanded_states_count_)); + next_pair->graph_state = std::make_shared(++expanded_states_count_); next_pair->atomic_propositions = std::move(propositions); if (current_pair) next_pair->depth = current_pair->depth + 1; diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index d05763b69a..527dd9e6b8 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -261,7 +261,7 @@ void GatherVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::stri CHECK_ACTION_PARAMS(action, comm_size + 1, 2) send_size = parse_double(action[2]); disps = std::vector(comm_size, 0); - recvcounts = std::shared_ptr>(new std::vector(comm_size)); + recvcounts = std::make_shared>(comm_size); if (name == "gatherv") { root = (action.size() > 3 + comm_size) ? std::stoi(action[3 + comm_size]) : 0; @@ -336,7 +336,7 @@ void ScatterVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::str CHECK_ACTION_PARAMS(action, comm_size + 1, 2) recv_size = parse_double(action[2 + comm_size]); disps = std::vector(comm_size, 0); - sendcounts = std::shared_ptr>(new std::vector(comm_size)); + sendcounts = std::make_shared>(comm_size); if (action.size() > 5 + comm_size) datatype1 = simgrid::smpi::Datatype::decode(action[4 + comm_size]); @@ -362,7 +362,7 @@ void ReduceScatterArgParser::parse(simgrid::xbt::ReplayAction& action, const std comm_size = MPI_COMM_WORLD->size(); CHECK_ACTION_PARAMS(action, comm_size + 1, 1) comp_size = parse_double(action[2 + comm_size]); - recvcounts = std::shared_ptr>(new std::vector(comm_size)); + recvcounts = std::make_shared>(comm_size); if (action.size() > 3 + comm_size) datatype1 = simgrid::smpi::Datatype::decode(action[3 + comm_size]); @@ -384,8 +384,8 @@ void AllToAllVArgParser::parse(simgrid::xbt::ReplayAction& action, const std::st */ comm_size = MPI_COMM_WORLD->size(); CHECK_ACTION_PARAMS(action, 2 * comm_size + 2, 2) - sendcounts = std::shared_ptr>(new std::vector(comm_size)); - recvcounts = std::shared_ptr>(new std::vector(comm_size)); + sendcounts = std::make_shared>(comm_size); + recvcounts = std::make_shared>(comm_size); senddisps = std::vector(comm_size, 0); recvdisps = std::vector(comm_size, 0); -- 2.20.1