Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Unsigned cannot become negative.
[simgrid.git] / src / s4u / s4u_Actor.cpp
index ec1085f..1b92776 100644 (file)
@@ -40,14 +40,15 @@ ActorPtr Actor::self()
 
 ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()> code)
 {
-  simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+  simgrid::kernel::actor::ActorImpl* actor =
+      simcall_process_create(std::move(name), std::move(code), nullptr, host, nullptr);
   return actor->iface();
 }
 
-ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
+ActorPtr Actor::create(std::string name, s4u::Host* host, const std::string& function, std::vector<std::string> args)
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
-  return create(name, host, factory(std::move(args)));
+  return create(std::move(name), host, factory(std::move(args)));
 }
 
 void intrusive_ptr_add_ref(Actor* actor)
@@ -227,14 +228,14 @@ std::unordered_map<std::string, std::string>* Actor::get_properties()
 }
 
 /** Retrieve the property value (or nullptr if not set) */
-const char* Actor::get_property(std::string key)
+const char* Actor::get_property(const std::string& key)
 {
   return simgrid::simix::simcall([this, key] { return pimpl_->get_property(key); });
 }
 
-void Actor::set_property(std::string key, std::string value)
+void Actor::set_property(const std::string& key, std::string value)
 {
-  simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, value); });
+  simgrid::simix::simcall([this, key, value] { pimpl_->set_property(key, std::move(value)); });
 }
 
 Actor* Actor::restart()