Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use (const) references with range-based for loops.
[simgrid.git] / src / bindings / lua / lua_platf.cpp
index 92de42a..cddfe8a 100644 (file)
@@ -132,7 +132,7 @@ int console_add_host___link(lua_State *L) {
   hostlink.link_down = lua_tostring(L, -1);
   lua_pop(L, 1);
 
-  XBT_DEBUG("Create a host_link for host %s", hostlink.id);
+  XBT_DEBUG("Create a host_link for host %s", hostlink.id.c_str());
   sg_platf_new_hostlink(&hostlink);
 
   return 0;
@@ -337,7 +337,7 @@ int console_add_route(lua_State *L) {
     route.link_list->push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
   } else {
     // Several names separated by , \t\r\n
-    for (auto name : names) {
+    for (auto const& name : names) {
       if (name.length() > 0) {
         simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
         route.link_list->push_back(link);
@@ -418,7 +418,7 @@ int console_add_ASroute(lua_State *L) {
     ASroute.link_list->push_back(simgrid::surf::LinkImpl::byName(lua_tostring(L, -1)));
   } else {
     // Several names separated by , \t\r\n
-    for (auto name : names) {
+    for (auto const& name : names) {
       if (name.length() > 0) {
         simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
         ASroute.link_list->push_back(link);