Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove dead assignment (mimic console_add_link()).
[simgrid.git] / src / bindings / lua / lua_platf.cpp
index 92de42a..6f45328 100644 (file)
@@ -5,7 +5,7 @@
 
 /* SimGrid Lua bindings                                                     */
 
-#include "lua_private.h"
+#include "lua_private.hpp"
 #include "src/kernel/routing/NetPoint.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
@@ -16,7 +16,7 @@ extern "C" {
 #include <lauxlib.h>
 }
 
-#include "src/surf/surf_private.h"
+#include "src/surf/surf_private.hpp"
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <simgrid/s4u/Host.hpp>
@@ -90,8 +90,9 @@ int console_add_backbone(lua_State *L) {
   lua_pop(L, 1);
 
   lua_pushstring(L, "sharing_policy");
-  type = lua_gettable(L, -2);
+  lua_gettable(L, -2);
   const char* policy = lua_tostring(L, -1);
+  lua_pop(L, 1);
   if (policy && not strcmp(policy, "FULLDUPLEX")) {
     link.policy = SURF_LINK_FULLDUPLEX;
   } else if (policy && not strcmp(policy, "FATPIPE")) {
@@ -132,7 +133,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 +338,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 +419,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);