Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 26 Mar 2020 13:20:04 +0000 (14:20 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 26 Mar 2020 13:20:04 +0000 (14:20 +0100)
examples/c/app-bittorrent/bittorrent-peer.c
examples/c/app-bittorrent/tracker.h
examples/c/dht-pastry/dht-pastry.c
examples/c/io-file-system/io-file-system.c
examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp
examples/s4u/mc-bugged1/s4u-mc-bugged1.cpp
examples/s4u/mc-bugged2/s4u-mc-bugged2.cpp
src/instr/instr_platform.cpp

index 14543f3..82698bf 100644 (file)
@@ -138,7 +138,7 @@ int get_peers_from_tracker(const_peer_t peer)
   sg_comm_t comm_received = sg_mailbox_get_async(peer->mailbox, &message);
   res                     = sg_comm_wait_for(comm_received, GET_PEERS_TIMEOUT);
   if (res == SG_OK) {
-    const tracker_answer_t ta = (const tracker_answer_t)message;
+    const_tracker_answer_t ta = (const_tracker_answer_t)message;
     // Add the peers the tracker gave us to our peer list.
     unsigned i;
     int peer_id;
index 663f9ed..5714ea0 100644 (file)
@@ -22,6 +22,7 @@ typedef struct s_tracker_answer {
   xbt_dynar_t peers; // the peer list the peer has asked for.
 } s_tracker_answer_t;
 typedef s_tracker_answer_t* tracker_answer_t;
+typedef const s_tracker_answer_t* const_tracker_answer_t;
 
 tracker_query_t tracker_query_new(int peer_id, sg_mailbox_t return_mailbox);
 tracker_answer_t tracker_answer_new(int interval);
index f26900a..b0784ec 100644 (file)
@@ -250,7 +250,6 @@ static void handle_message(node_t node, pastry_message_t message)
       err                = sg_comm_wait_for(comm, timeout);
       if (err == SG_ERROR_TIMEOUT) {
         XBT_DEBUG("Timeout expired when sending back the current node state to the joining node to %d", node->id);
-        message_free(message);
       }
       break;
     /* Join reply from all the node touched by the join  */
index 6d2399f..c860102 100644 (file)
@@ -17,7 +17,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(io_file_system, "Messages specific for this io example");
 
-static void show_info(unsigned int disk_count, sg_disk_t* disks)
+static void show_info(unsigned int disk_count, const sg_disk_t* disks)
 {
   XBT_INFO("Storage info on %s:", sg_host_self_get_name());
 
index 9df9872..6822f38 100644 (file)
@@ -47,7 +47,7 @@ static void garbage_stack(void)
 static void coordinator()
 {
   int CS_used = 0;
-  Message* m  = nullptr;
+  const Message* m = nullptr;
   std::queue<simgrid::s4u::Mailbox*> requests;
 
   simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name("coordinator");
@@ -101,7 +101,7 @@ static void client(int id)
       XBT_INFO("Propositions changed : r=1, cs=0");
     }
 
-    Message* grant = static_cast<Message*>(my_mailbox->get());
+    const Message* grant = static_cast<Message*>(my_mailbox->get());
 
     if ((id == 1) && (grant->kind == Message::Kind::GRANT)) {
       cs = 1;
index 802403d..74ca56f 100644 (file)
@@ -11,7 +11,7 @@
 #include <simgrid/modelchecker.h>
 #include <simgrid/s4u.hpp>
 
-#define N 3
+constexpr int N = 3;
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example");
 
index 6a89f02..66c085e 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <simgrid/modelchecker.h>
 #include <simgrid/s4u.hpp>
-#define N 3
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example");
 
index b3c60e7..595b8eb 100644 (file)
@@ -360,7 +360,7 @@ void define_callbacks()
     kernel::routing::NetPoint::on_creation.connect(on_netpoint_creation);
   }
   s4u::NetZone::on_creation.connect(on_netzone_creation);
-  s4u::Engine::on_time_advance.connect([](double time_delta) { TRACE_paje_dump_buffer(false); });
+  s4u::Engine::on_time_advance.connect([](double /*time_delta*/) { TRACE_paje_dump_buffer(false); });
 
   kernel::resource::CpuAction::on_state_change.connect(on_action_state_change);
   s4u::Link::on_communication_state_change.connect(on_action_state_change);