Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference local variables in examples/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 23:16:01 +0000 (00:16 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 23:33:39 +0000 (00:33 +0100)
33 files changed:
examples/deprecated/msg/dht-kademlia/answer.c
examples/deprecated/msg/dht-kademlia/dht-kademlia.c
examples/deprecated/msg/mc/bugged2_liveness.c
examples/deprecated/simdag/dag-dotload/sd_dag-dotload.c
examples/deprecated/simdag/daxload/sd_daxload.c
examples/deprecated/simdag/schedule-dotload/sd_schedule-dotload.c
examples/deprecated/simdag/scheduling/sd_scheduling.c
examples/deprecated/simdag/test/sd_test.cpp
examples/s4u/actor-create/s4u-actor-create.cpp
examples/s4u/app-chainsend/s4u-app-chainsend.cpp
examples/s4u/app-masterworkers/s4u-app-masterworkers-class.cpp
examples/s4u/app-masterworkers/s4u-app-masterworkers-fun.cpp
examples/s4u/app-pingpong/s4u-app-pingpong.cpp
examples/s4u/app-token-ring/s4u-app-token-ring.cpp
examples/s4u/async-ready/s4u-async-ready.cpp
examples/s4u/async-wait/s4u-async-wait.cpp
examples/s4u/async-waitall/s4u-async-waitall.cpp
examples/s4u/async-waitany/s4u-async-waitany.cpp
examples/s4u/async-waituntil/s4u-async-waituntil.cpp
examples/s4u/cloud-migration/s4u-cloud-migration.cpp
examples/s4u/cloud-simple/s4u-cloud-simple.cpp
examples/s4u/dht-chord/s4u-dht-chord-node.cpp
examples/s4u/dht-kademlia/node.cpp
examples/s4u/exec-remote/s4u-exec-remote.cpp
examples/s4u/exec-waitfor/s4u-exec-waitfor.cpp
examples/s4u/io-async/s4u-io-async.cpp
examples/s4u/io-disk-raw/s4u-io-disk-raw.cpp
examples/s4u/io-file-system/s4u-io-file-system.cpp
examples/s4u/maestro-set/s4u-maestro-set.cpp
examples/s4u/mc-failing-assert/s4u-mc-failing-assert.cpp
examples/s4u/platform-failures/s4u-platform-failures.cpp
examples/s4u/platform-profile/s4u-platform-profile.cpp
examples/s4u/platform-properties/s4u-platform-properties.cpp

index fb3bcc2..681a0af 100644 (file)
@@ -69,8 +69,8 @@ unsigned int answer_merge(answer_t destination, answer_t source)
 /** Helper to sort answer_t objects */
 static int _answer_sort_function(const void *e1, const void *e2)
 {
-  node_contact_t c1 = *(const node_contact_t*)e1;
-  node_contact_t c2 = *(const node_contact_t*)e2;
+  const s_node_contact_t* c1 = *(const node_contact_t*)e1;
+  const s_node_contact_t* c2 = *(const node_contact_t*)e2;
   if (c1->distance == c2->distance)
     return 0;
   else
@@ -147,6 +147,6 @@ unsigned int answer_destination_found(answer_t answer)
   if (xbt_dynar_is_empty(answer->nodes)) {
     return 0;
   }
-  node_contact_t contact_tail = xbt_dynar_get_as(answer->nodes, 0, node_contact_t);
+  const s_node_contact_t* contact_tail = xbt_dynar_get_as(answer->nodes, 0, node_contact_t);
   return contact_tail->distance == 0;
 }
index 3ffb289..f33ba10 100644 (file)
@@ -111,7 +111,7 @@ static int node(int argc, char *argv[])
   */
 unsigned int join(node_t node, unsigned int id_known)
 {
-  answer_t node_list;
+  const s_answer_t* node_list;
   msg_error_t status;
   unsigned int trial = 0;
   unsigned int i;
@@ -137,7 +137,7 @@ unsigned int join(node_t node, unsigned int id_known)
           XBT_DEBUG("Received an answer from the node I know.");
           answer_got = 1;
           //retrieve the node list and ping them.
-          task_data_t data = MSG_task_get_data(node->task_received);
+          const s_task_data_t* data = MSG_task_get_data(node->task_received);
           xbt_assert((data != NULL), "Null data received");
           if (data->type == TASK_FIND_NODE_ANSWER) {
             node_contact_t contact;
@@ -217,7 +217,7 @@ unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_
           if (status == MSG_OK) {
             xbt_assert((node->task_received != NULL), "Invalid task received");
             //Figure out if we received an answer or something else
-            task_data_t data = MSG_task_get_data(node->task_received);
+            const s_task_data_t* data = MSG_task_get_data(node->task_received);
             xbt_assert((data != NULL), "No data in the task");
 
             //Check if what we have received is what we are looking for.
@@ -309,7 +309,7 @@ unsigned int send_find_node_to_best(node_t node, answer_t node_list)
   while (j < KADEMLIA_ALPHA && i < node_list->size) {
     /* We need to have at most "KADEMLIA_ALPHA" requests each time, according to the protocol */
     /* Gets the node we want to send the query to */
-    node_contact_t node_to_query = xbt_dynar_get_as(node_list->nodes, i, node_contact_t);
+    const s_node_contact_t* node_to_query = xbt_dynar_get_as(node_list->nodes, i, node_contact_t);
     if (node_to_query->id != node->id) {        /* No need to query ourselves */
       send_find_node(node, node_to_query->id, destination);
       j++;
index 2b68854..a1a7efa 100644 (file)
@@ -25,7 +25,7 @@ static int coordinator(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[
     MSG_task_receive(&task, "coordinator");
     const char *kind = MSG_task_get_name(task); //is it a request or a release?
     if (!strcmp(kind, "request")) {     // that's a request
-      char *req = MSG_task_get_data(task);
+      const char* req = MSG_task_get_data(task);
       if (CS_used) {
         XBT_INFO("CS already used.");
         msg_task_t answer = MSG_task_create("not grant", 0, 1000, NULL);
index 95c8d81..9bbb559 100644 (file)
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
   }
 
   char *tracefilename;
-  char *last = strrchr(argv[2], '.');
+  const char* last = strrchr(argv[2], '.');
   tracefilename = bprintf("%.*s.trace", (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),argv[2]);
   if (argc == 4)
     tracefilename = xbt_strdup(argv[3]);
index 098c3e8..376007d 100644 (file)
@@ -31,7 +31,7 @@ int main(int argc, char **argv)
   xbt_assert(argc > 2, "Usage: %s platform_file dax_file [jedule_file]\n"
        "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", argv[0], argv[0]);
 
-  char *last = strrchr(argv[2], '.');
+  const char* last     = strrchr(argv[2], '.');
   char * tracefilename = bprintf("%.*s.trace",(int) (last == NULL ? strlen(argv[2]):last - argv[2]), argv[2]);
   if (argc == 4)
     tracefilename = xbt_strdup(argv[3]);
@@ -81,7 +81,7 @@ int main(int argc, char **argv)
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
   XBT_INFO("------------------- Produce the trace file---------------------------");
-  char* basename = strrchr(tracefilename, '/');
+  const char* basename = strrchr(tracefilename, '/');
   XBT_INFO("Producing the trace of the run into %s", basename ? basename + 1 : tracefilename);
   FILE *out = fopen(tracefilename, "w");
   xbt_assert(out, "Cannot write to %s", tracefilename);
index 7a50b4c..6be282e 100644 (file)
@@ -38,7 +38,7 @@ int main(int argc, char **argv)
   }
 
   char *tracefilename;
-  char *last = strrchr(argv[2], '.');
+  const char* last = strrchr(argv[2], '.');
   tracefilename = bprintf("%.*s.trace", (int) (last == NULL ? strlen(argv[2]) : last - argv[2]),argv[2]);
   if (argc == 4)
     tracefilename = xbt_strdup(argv[3]);
index c7cd717..5da1b6a 100644 (file)
@@ -24,7 +24,7 @@ struct _HostAttribute {
 
 static double sg_host_get_available_at(sg_host_t host)
 {
-  HostAttribute attr = (HostAttribute)sg_host_data(host);
+  const struct _HostAttribute* attr = (HostAttribute)sg_host_data(host);
   return attr->available_at;
 }
 
@@ -36,7 +36,7 @@ static void sg_host_set_available_at(sg_host_t host, double time)
 }
 
 static SD_task_t sg_host_get_last_scheduled_task( sg_host_t host){
-  HostAttribute attr = (HostAttribute)sg_host_data(host);
+  const struct _HostAttribute* attr = (HostAttribute)sg_host_data(host);
   return attr->last_scheduled_task;
 }
 
index 59fead5..d2d34c0 100644 (file)
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
   SD_task_schedule(taskC, 2, host_list, computation_amount, communication_amount, -1);
   SD_task_schedule(taskD, 2, host_list, computation_amount, communication_amount, -1);
 
-  std::set<SD_task_t> *changed_tasks = simgrid::sd::simulate(-1.0);
+  const std::set<SD_task_t>* changed_tasks = simgrid::sd::simulate(-1.0);
   for (auto const& task : *changed_tasks) {
     XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task),
           SD_task_get_start_time(task), SD_task_get_finish_time(task));
index b587f42..2bd2508 100644 (file)
@@ -33,9 +33,9 @@ static void receiver(const std::string& mailbox_name)
 
   XBT_INFO("Hello s4u, I'm ready to get any message you'd want on %s", mailbox->get_cname());
 
-  std::string* msg1 = static_cast<std::string*>(mailbox->get());
-  std::string* msg2 = static_cast<std::string*>(mailbox->get());
-  std::string* msg3 = static_cast<std::string*>(mailbox->get());
+  const std::string* msg1 = static_cast<std::string*>(mailbox->get());
+  const std::string* msg2 = static_cast<std::string*>(mailbox->get());
+  const std::string* msg3 = static_cast<std::string*>(mailbox->get());
   XBT_INFO("I received '%s', '%s' and '%s'", msg1->c_str(), msg2->c_str(), msg3->c_str());
   delete msg1;
   delete msg2;
index dc1abf5..ffaff0a 100644 (file)
@@ -47,7 +47,7 @@ public:
 
   void joinChain()
   {
-    ChainMessage* msg = static_cast<ChainMessage*>(me->get());
+    const ChainMessage* msg = static_cast<ChainMessage*>(me->get());
     prev              = msg->prev_;
     next              = msg->next_;
     total_pieces      = msg->num_pieces;
index a91f203..8249b11 100644 (file)
@@ -67,7 +67,7 @@ public:
   {
     double compute_cost;
     do {
-      double* msg  = static_cast<double*>(mailbox->get());
+      const double* msg = static_cast<double*>(mailbox->get());
       compute_cost = *msg;
       delete msg;
 
index 40780fc..6d57fef 100644 (file)
@@ -49,12 +49,12 @@ static void worker(std::vector<std::string> args)
 {
   xbt_assert(args.size() == 1, "The worker expects no argument");
 
-  simgrid::s4u::Host* my_host      = simgrid::s4u::this_actor::get_host();
+  const simgrid::s4u::Host* my_host = simgrid::s4u::this_actor::get_host();
   simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(my_host->get_name());
 
   double compute_cost;
   do {
-    double* msg  = static_cast<double*>(mailbox->get());
+    const double* msg = static_cast<double*>(mailbox->get());
     compute_cost = *msg;
     delete msg;
 
index 019d6b2..03fa89a 100644 (file)
@@ -17,7 +17,7 @@ static void pinger(simgrid::s4u::Mailbox* mailbox_in, simgrid::s4u::Mailbox* mai
 
   mailbox_out->put(payload, 1);
   /* - ... then wait for the (large) pong */
-  double* sender_time = static_cast<double*>(mailbox_in->get());
+  const double* sender_time = static_cast<double*>(mailbox_in->get());
 
   double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time;
   XBT_INFO("Task received : large communication (bandwidth bound)");
@@ -30,7 +30,7 @@ static void ponger(simgrid::s4u::Mailbox* mailbox_in, simgrid::s4u::Mailbox* mai
   XBT_INFO("Pong from mailbox %s to mailbox %s", mailbox_in->get_name().c_str(), mailbox_out->get_name().c_str());
 
   /* - Receive the (small) ping first ....*/
-  double* sender_time       = static_cast<double*>(mailbox_in->get());
+  const double* sender_time = static_cast<double*>(mailbox_in->get());
   double communication_time = simgrid::s4u::Engine::get_clock() - *sender_time;
   XBT_INFO("Task received : small communication (latency bound)");
   XBT_INFO(" Ping time (latency bound) %f", communication_time);
index 2774114..50cd5ec 100644 (file)
@@ -24,7 +24,7 @@ public:
   {
     try {
       rank = std::stoi(simgrid::s4u::this_actor::get_name());
-    } catch (std::invalid_argument& ia) {
+    } catch (const std::invalid_argument& ia) {
       throw std::invalid_argument(std::string("Processes of this example must have a numerical name, not ") +
                                   ia.what());
     }
@@ -41,7 +41,7 @@ public:
       XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->get_cname());
       std::string msg = "Token";
       neighbor_mailbox->put(&msg, task_comm_size);
-      std::string* res = static_cast<std::string*>(my_mailbox->get());
+      const std::string* res = static_cast<std::string*>(my_mailbox->get());
       XBT_INFO("Host \"%u\" received \"%s\"", rank, res->c_str());
     } else {
       std::string* res = static_cast<std::string*>(my_mailbox->get());
index d73f2ce..ca868e2 100644 (file)
@@ -72,7 +72,7 @@ static int peer(int argc, char** argv)
   while (pending_finalize_messages > 0) {
     if (my_mbox->ready()) {
       double start          = simgrid::s4u::Engine::get_clock();
-      std::string* received = static_cast<std::string*>(my_mbox->get());
+      const std::string* received = static_cast<std::string*>(my_mbox->get());
       double waiting_time   = simgrid::s4u::Engine::get_clock() - start;
       xbt_assert(waiting_time == 0, "Expecting the waiting time to be 0 because the communication was supposedly ready, but got %f instead", waiting_time);
       XBT_INFO("I got a '%s'.", received->c_str());
index 009c9fa..4e06ea7 100644 (file)
@@ -74,7 +74,7 @@ static int receiver(int argc, char** argv)
 
   XBT_INFO("Wait for my first message");
   for (bool cont = true; cont;) {
-    std::string* received = static_cast<std::string*>(mbox->get());
+    const std::string* received = static_cast<std::string*>(mbox->get());
     XBT_INFO("I got a '%s'.", received->c_str());
     if (*received == "finalize")
       cont = false; // If it's a finalize message, we're done.
index f23e55c..53d2a3e 100644 (file)
@@ -89,7 +89,7 @@ public:
   {
     XBT_INFO("Wait for my first message");
     for (bool cont = true; cont;) {
-      std::string* received = static_cast<std::string*>(mbox->get());
+      const std::string* received = static_cast<std::string*>(mbox->get());
       XBT_INFO("I got a '%s'.", received->c_str());
       cont = (*received != "finalize"); // If it's a finalize message, we're done
       // Receiving the message was all we were supposed to do
index 407b4e5..5c58131 100644 (file)
@@ -102,7 +102,7 @@ public:
   {
     XBT_INFO("Wait for my first message");
     for (bool cont = true; cont;) {
-      std::string* received = static_cast<std::string*>(mbox->get());
+      const std::string* received = static_cast<std::string*>(mbox->get());
       XBT_INFO("I got a '%s'.", received->c_str());
       cont = (*received != "finalize"); // If it's a finalize message, we're done
       // Receiving the message was all we were supposed to do
index 3397408..3d5cfac 100644 (file)
@@ -72,7 +72,7 @@ static int receiver(int argc, char** argv)
 
   XBT_INFO("Wait for my first message");
   for (bool cont = true; cont;) {
-    std::string* received = static_cast<std::string*>(mbox->get());
+    const std::string* received = static_cast<std::string*>(mbox->get());
     XBT_INFO("I got a '%s'.", received->c_str());
     if (*received == "finalize")
       cont = false; // If it's a finalize message, we're done.
index 8add881..ecceb5d 100644 (file)
@@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_cloud_migration, "Messages specific for this ex
 
 static void vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
 {
-  simgrid::s4u::Host* src_pm = vm->get_pm();
+  const simgrid::s4u::Host* src_pm = vm->get_pm();
   double mig_sta             = simgrid::s4u::Engine::get_clock();
   sg_vm_migrate(vm, dst_pm);
   double mig_end = simgrid::s4u::Engine::get_clock();
index 08a341a..95e843d 100644 (file)
@@ -47,7 +47,7 @@ static void communication_rx_fun(std::vector<std::string> args)
   const char* host_name         = simgrid::s4u::this_actor::get_host()->get_cname();
   simgrid::s4u::Mailbox* mbox   = simgrid::s4u::Mailbox::by_name(args.at(0));
 
-  struct s_payload* payload = static_cast<struct s_payload*>(mbox->get());
+  const s_payload* payload  = static_cast<struct s_payload*>(mbox->get());
   double clock_end          = simgrid::s4u::Engine::get_clock();
 
   XBT_INFO("%s:%s to %s:%s => %g sec", payload->tx_host->get_cname(), payload->tx_actor_name, host_name, actor_name,
index f76484c..7ea070e 100644 (file)
@@ -267,7 +267,7 @@ int Node::remoteGetPredecessor(int ask_to)
 
   try {
     comm->wait_for(timeout);
-    ChordMessage* answer = static_cast<ChordMessage*>(data);
+    const ChordMessage* answer = static_cast<ChordMessage*>(data);
     XBT_DEBUG("Received the answer to my 'Get Predecessor' request: the predecessor of node %d is %d", ask_to,
               answer->answer_id);
     predecessor_id = answer->answer_id;
@@ -337,7 +337,7 @@ int Node::remoteFindSuccessor(int ask_to, int id)
 
   try {
     comm->wait_for(timeout);
-    ChordMessage* answer = static_cast<ChordMessage*>(data);
+    const ChordMessage* answer = static_cast<ChordMessage*>(data);
     XBT_DEBUG("Received the answer to my 'Find Successor' request for id %d: the successor of key %d is %d",
               answer->request_id, id_, answer->answer_id);
     successor = answer->answer_id;
index 617f382..961e8b9 100644 (file)
@@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(kademlia_node, "Messages specific for this example"
 namespace kademlia {
 static void destroy(void* message)
 {
-  Message* msg = static_cast<Message*>(message);
+  const Message* msg = static_cast<Message*>(message);
   delete msg->answer_;
   delete msg;
 }
@@ -22,7 +22,7 @@ static void destroy(void* message)
   */
 bool Node::join(unsigned int known_id)
 {
-  Answer* node_list;
+  const Answer* node_list;
   unsigned int i;
   bool got_answer = false;
 
index 4c0699c..49814cb 100644 (file)
@@ -9,7 +9,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example")
 
 static void wizard()
 {
-  simgrid::s4u::Host* fafard  = simgrid::s4u::Host::by_name("Fafard");
+  const simgrid::s4u::Host* fafard = simgrid::s4u::Host::by_name("Fafard");
   simgrid::s4u::Host* ginette = simgrid::s4u::Host::by_name("Ginette");
   simgrid::s4u::Host* boivin  = simgrid::s4u::Host::by_name("Boivin");
 
index 6aeccfe..8644214 100644 (file)
@@ -20,7 +20,7 @@ static void worker()
   try {
     exec->wait_for(3);
     XBT_INFO("Execution complete");
-  } catch (simgrid::TimeoutException&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Execution Timeout!");
   }
 
@@ -30,7 +30,7 @@ static void worker()
   try {
     exec->wait_for(6);
     XBT_INFO("Execution complete");
-  } catch (simgrid::TimeoutException&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Execution Timeout!");
   }
 
@@ -50,7 +50,7 @@ static void worker()
   try {
     exec->wait_for(2);
     XBT_INFO("Parallel Execution complete");
-  } catch (simgrid::TimeoutException&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Parallel Execution Timeout!");
   }
 }
index fe9deac..7ac77db 100644 (file)
@@ -27,7 +27,7 @@ static void test_waitfor(sg_size_t size)
   simgrid::s4u::IoPtr activity = disk->write_async(size);
   try {
     activity->wait_for(0.5);
-  } catch (simgrid::TimeoutException&) {
+  } catch (const simgrid::TimeoutException&) {
     XBT_INFO("Asynchronous write: Timeout!");
   }
 
index d51781a..49c9093 100644 (file)
@@ -34,7 +34,7 @@ static void host()
   /* - Attach some user data to disk1 */
   XBT_INFO("*** Get/set data for storage element: Disk1 ***");
 
-  std::string* data = static_cast<std::string*>(disk->get_data());
+  const std::string* data = static_cast<std::string*>(disk->get_data());
 
   XBT_INFO("Get storage data: '%s'", data ? data->c_str() : "No user data");
 
index 6a74e1b..fe5ad8d 100644 (file)
@@ -57,7 +57,7 @@ public:
 
     // Test attaching some user data to the file
     file->set_data(new std::string("777"));
-    std::string* file_data = static_cast<std::string*>(file->get_data());
+    const std::string* file_data = static_cast<std::string*>(file->get_data());
     XBT_INFO("User data attached to the file: %s", file_data->c_str());
     delete file_data;
 
index 1088559..336c74d 100644 (file)
@@ -48,7 +48,7 @@ static void receiver()
 {
   ensure_other_tid();
 
-  std::string* payload = static_cast<std::string*>(simgrid::s4u::Mailbox::by_name("some mailbox")->get());
+  const std::string* payload = static_cast<std::string*>(simgrid::s4u::Mailbox::by_name("some mailbox")->get());
   XBT_INFO("Task received");
   delete payload;
 }
index b87e6f4..7ce578c 100644 (file)
@@ -18,7 +18,7 @@ static int server(int worker_amount)
   int value_got             = -1;
   simgrid::s4u::Mailbox* mb = simgrid::s4u::Mailbox::by_name("server");
   for (int count = 0; count < worker_amount; count++) {
-    int* msg  = static_cast<int*>(mb->get());
+    const int* msg = static_cast<int*>(mb->get());
     value_got = *msg;
     delete msg;
   }
index 0c5bf2d..d2271b2 100644 (file)
@@ -75,7 +75,7 @@ static int worker(int argc, char* argv[])
   xbt_assert(argc == 2, "Expecting one parameter");
   long id                          = xbt_str_parse_int(argv[1], "Invalid argument %s");
   simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(std::string("worker-") + std::to_string(id));
-  double* payload                  = nullptr;
+  const double* payload            = nullptr;
   double comp_size                 = -1;
   while (1) {
     try {
index 5483c2f..ceae1de 100644 (file)
@@ -15,10 +15,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_platform_profile, "Messages specific for this s
 /* Main function of the Yielder process */
 static void watcher()
 {
-  simgrid::s4u::Host* jupiter = simgrid::s4u::Host::by_name("Jupiter");
-  simgrid::s4u::Host* fafard  = simgrid::s4u::Host::by_name("Fafard");
-  simgrid::s4u::Link* link1   = simgrid::s4u::Link::by_name("1");
-  simgrid::s4u::Link* link2   = simgrid::s4u::Link::by_name("2");
+  const simgrid::s4u::Host* jupiter = simgrid::s4u::Host::by_name("Jupiter");
+  const simgrid::s4u::Host* fafard  = simgrid::s4u::Host::by_name("Fafard");
+  const simgrid::s4u::Link* link1   = simgrid::s4u::Link::by_name("1");
+  const simgrid::s4u::Link* link2   = simgrid::s4u::Link::by_name("2");
 
   for (int i = 0; i < 10; i++) {
     XBT_INFO("Fafard: %.0fGflops, Jupiter: % 3.0fGflops, Link1: (%.2fMB/s %.0fms), Link2: (%.2fMB/s %.0fms)",
index 12e793d..7167722 100644 (file)
@@ -84,7 +84,7 @@ static void david(std::vector<std::string> /*args*/)
 static void bob(std::vector<std::string> /*args*/)
 {
   /* this host also tests the properties of the AS*/
-  simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->get_netzone_root();
+  const simgrid::s4u::NetZone* root = simgrid::s4u::Engine::get_instance()->get_netzone_root();
   XBT_INFO("== Print the properties of the root zone");
   XBT_INFO("   Zone property: filename -> %s", root->get_property("filename"));
   XBT_INFO("   Zone property: date -> %s", root->get_property("date"));