From: Arnaud Giersch Date: Tue, 23 Mar 2021 12:39:05 +0000 (+0100) Subject: [sonar] Pass large object by reference to const. X-Git-Tag: v3.27~57 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/406aea71498dca53009d9ddc0a9af44aaff21618?hp=8faace53c793bab8c0df390bd56d5326c84550ec [sonar] Pass large object by reference to const. --- diff --git a/include/xbt/replay.hpp b/include/xbt/replay.hpp index c9336b2ce8..ce0d124908 100644 --- a/include/xbt/replay.hpp +++ b/include/xbt/replay.hpp @@ -32,6 +32,6 @@ XBT_PUBLIC int replay_runner(const char* actor_name, const char* trace_filename using action_fun = std::function; XBT_PUBLIC void xbt_replay_action_register(const char* action_name, const action_fun& function); XBT_PUBLIC action_fun xbt_replay_action_get(const char* action_name); -XBT_PUBLIC void xbt_replay_set_tracefile(std::string filename); +XBT_PUBLIC void xbt_replay_set_tracefile(const std::string& filename); #endif diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index ce546bea3c..6bebd90c8e 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -184,9 +184,9 @@ action_fun xbt_replay_action_get(const char* action_name) return simgrid::xbt::action_funs.at(std::string(action_name)); } -void xbt_replay_set_tracefile(std::string filename) +void xbt_replay_set_tracefile(const std::string& filename) { xbt_assert(not simgrid::xbt::action_fs_inited, "Tracefile already set"); simgrid::xbt::action_fs.open(filename, std::ifstream::in); simgrid::xbt::action_fs_inited = true; -} \ No newline at end of file +}