Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further codacy cleanups
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 24 May 2017 20:12:16 +0000 (22:12 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 24 May 2017 20:12:16 +0000 (22:12 +0200)
examples/msg/app-bittorrent/peer.c
examples/msg/dht-kademlia/dht-kademlia.c
examples/msg/dht-pastry/dht-pastry.c
src/xbt/dict_cursor.c
teshsuite/msg/host_on_off/host_on_off.c

index 172199a..d787519 100644 (file)
@@ -672,9 +672,8 @@ void update_interested_after_receive(peer_t peer)
   char *key;
   xbt_dict_cursor_t cursor;
   connection_t connection;
-  int interested;
   xbt_dict_foreach(peer->peers, cursor, key, connection) {
-    interested = 0;
+    int interested = 0;
     if (connection->am_interested != 0) {
       //Check if the peer still has a piece we want.
       for (int i = 0; i < FILE_PIECES; i++) {
index 439ad0f..317a646 100644 (file)
@@ -183,8 +183,6 @@ unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_
   unsigned int answers;
   unsigned int destination_found = 0;
   unsigned int nodes_added = 0;
-  double time_beginreceive;
-  double timeout;
   double global_timeout = MSG_get_clock() + find_node_global_timeout;
   unsigned int steps = 0;
 
@@ -203,9 +201,9 @@ unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_
     answers = 0;
     queries = send_find_node_to_best(node, node_list);
     nodes_added = 0;
-    timeout = MSG_get_clock() + find_node_timeout;
+    double timeout = MSG_get_clock() + find_node_timeout;
     steps++;
-    time_beginreceive = MSG_get_clock();
+    double time_beginreceive = MSG_get_clock();
     do {
       if (node->receive_comm == NULL) {
         node->task_received = NULL;
index 782b7ba..b9cac1e 100644 (file)
@@ -230,7 +230,6 @@ static void handle_task(node_t node, msg_task_t task) {
   int j;
   int min;
   int max;
-  int d;
   int next;
   msg_task_t task_sent;
   task_data_t req_data;
@@ -303,11 +302,11 @@ static void handle_task(node_t node, msg_task_t task) {
       min = (node->id==task_data->answer_id) ? 0 : shl(node->id, task_data->answer_id);
       max = shl(node->id, task_data->sender_id)+1;
       for (i=min;i<max;i++) {
-        d = domain(node->id, i); 
+        int d = domain(node->id, i);
         for (j=0; j<LEVEL_SIZE; j++)
           if (d!=j)
             node->routing_table[i][j] =  task_data->state->routing_table[i][j];
-          }
+      }
 
       node->ready--;
       // if the node is ready, do all the pending tasks and send update to known nodes
index d9f3b14..38c7930 100644 (file)
@@ -27,9 +27,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_cursor, xbt_dict, "To traverse dictiona
  */
 inline xbt_dict_cursor_t xbt_dict_cursor_new(const xbt_dict_t dict)
 {
-  xbt_dict_cursor_t res = NULL;
-
-  res = xbt_new(s_xbt_dict_cursor_t, 1);
+  xbt_dict_cursor_t res = xbt_new(s_xbt_dict_cursor_t, 1);
   res->dict = dict;
 
   xbt_dict_cursor_rewind(res);
index c7df906..f714d3f 100644 (file)
@@ -40,10 +40,9 @@ static int master(int argc, char *argv[])
   double task_comm_size = 1E6;
 
   const char * mailbox = "jupi";
-  msg_task_t task = NULL;
   msg_host_t jupiter = MSG_host_by_name("Jupiter");
 
-  task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
+  msg_task_t task = MSG_task_create("task on", task_comp_size, task_comm_size, NULL);
   XBT_INFO("Sending \"%s\"", task->name);
   if (MSG_task_send_with_timeout(task, mailbox, 1) != MSG_OK)
     MSG_task_destroy(task);