Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please my old friend SonarQube now that it's back
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 5 Dec 2016 23:06:06 +0000 (00:06 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 5 Dec 2016 23:06:06 +0000 (00:06 +0100)
examples/msg/platform-failures/platform-failures.c
examples/msg/trace-process-migration/trace-process-migration.c
examples/s4u/io/s4u_io.cpp
examples/simdag/fail/sd_fail.c
src/kernel/activity/SynchroComm.cpp

index 710b5f1..5e44285 100644 (file)
@@ -93,7 +93,6 @@ static int master(int argc, char *argv[])
 
 static int worker(int argc, char *argv[])
 {
-  msg_task_t task = NULL;
   char mailbox[80];
 
   long id= xbt_str_parse_int(argv[1], "Invalid argument %s");
@@ -102,13 +101,13 @@ static int worker(int argc, char *argv[])
 
   while (1) {
     double time1 = MSG_get_clock();
+    msg_task_t task = NULL;
     int retcode = MSG_task_receive( &(task), mailbox);
     double time2 = MSG_get_clock();
     if (retcode == MSG_OK) {
       XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
       if (MSG_task_get_data(task) == FINALIZE) {
         MSG_task_destroy(task);
-        task = NULL;
         break;
       }
       if (time1 < *((double *) task->data))
@@ -119,11 +118,9 @@ static int worker(int argc, char *argv[])
       if (retcode == MSG_OK) {
         XBT_INFO("\"%s\" done", MSG_task_get_name(task));
         MSG_task_destroy(task);
-        task = NULL;
       } else if (retcode == MSG_HOST_FAILURE) {
         XBT_INFO("Gloups. The cpu on which I'm running just turned off!. See you!");
         MSG_task_destroy(task);
-        task = NULL;
         return 0;
       } else {
         XBT_INFO("Hey ?! What's up ? ");
index bf27730..59d88a8 100644 (file)
@@ -29,8 +29,6 @@ static int emigrant(int argc, char *argv[])
 
 static int policeman(int argc, char *argv[])
 {
-  msg_task_t task = NULL;
-
   // I am the master of emigrant process,
   // I tell it where it must emigrate to.
   xbt_dynar_t destinations = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
@@ -47,13 +45,12 @@ static int policeman(int argc, char *argv[])
   char *destination;
   unsigned int i;
   xbt_dynar_foreach(destinations, i, destination){
-    task = MSG_task_create("task", 0, 0, NULL);
+    msg_task_t task = MSG_task_create("task", 0, 0, NULL);
     if (destination != NULL){
       MSG_task_set_data(task, xbt_strdup (destination));
     }
     MSG_task_set_category(task, "migration_order");
     MSG_task_send (task, "master_mailbox");
-    task = NULL;
   }
   xbt_dynar_free (&destinations);
   return 0;
index d5c24cf..7499e4d 100644 (file)
@@ -77,26 +77,6 @@ public:
 
     storage.setUserdata(xbt_strdup("Some user data"));
     XBT_INFO("    Set and get data: '%s'", (char*)storage.userdata());
-
-    /*
-      // Dump disks contents
-      XBT_INFO("*** Dump content of %s ***",Host::current()->name());
-      xbt_dict_t contents = NULL;
-      contents = MSG_host_get_storage_content(MSG_host_self()); // contents is a dict of dicts
-      xbt_dict_cursor_t curs, curs2 = NULL;
-      char* mountname;
-      xbt_dict_t content;
-      char* path;
-      sg_size_t *size;
-      xbt_dict_foreach(contents, curs, mountname, content){
-        XBT_INFO("Print the content of mount point: %s",mountname);
-        xbt_dict_foreach(content,curs2,path,size){
-           XBT_INFO("%s size: %llu bytes", path,*((sg_size_t*)size));
-        }
-      xbt_dict_free(&content);
-      }
-      xbt_dict_free(&contents);
-     */
   }
 };
 
index 30c3b75..995932a 100644 (file)
@@ -51,7 +51,6 @@ int main(int argc, char **argv)
            SD_task_get_finish_time(task));
 
   SD_task_destroy(task);
-  task=NULL;
 
   XBT_INFO("Second test: NON TYPED task");
 
index 4367536..72350ad 100644 (file)
@@ -11,9 +11,9 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network);
 
-simgrid::kernel::activity::Comm::Comm(e_smx_comm_type_t _type) {
+simgrid::kernel::activity::Comm::Comm(e_smx_comm_type_t _type) : type(_type)
+{
   state = SIMIX_WAITING;
-  this->type = _type;
   src_data=nullptr;
   dst_data=nullptr;