From 4f566b4572ad07940ea23d86d4af4abeaed7b4c7 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 6 Dec 2016 00:06:06 +0100 Subject: [PATCH 1/1] please my old friend SonarQube now that it's back --- .../msg/platform-failures/platform-failures.c | 5 +---- .../trace-process-migration.c | 5 +---- examples/s4u/io/s4u_io.cpp | 20 ------------------- examples/simdag/fail/sd_fail.c | 1 - src/kernel/activity/SynchroComm.cpp | 4 ++-- 5 files changed, 4 insertions(+), 31 deletions(-) diff --git a/examples/msg/platform-failures/platform-failures.c b/examples/msg/platform-failures/platform-failures.c index 710b5f16dc..5e4428548a 100644 --- a/examples/msg/platform-failures/platform-failures.c +++ b/examples/msg/platform-failures/platform-failures.c @@ -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 ? "); diff --git a/examples/msg/trace-process-migration/trace-process-migration.c b/examples/msg/trace-process-migration/trace-process-migration.c index bf27730181..59d88a85d8 100644 --- a/examples/msg/trace-process-migration/trace-process-migration.c +++ b/examples/msg/trace-process-migration/trace-process-migration.c @@ -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; diff --git a/examples/s4u/io/s4u_io.cpp b/examples/s4u/io/s4u_io.cpp index d5c24cf5b2..7499e4d774 100644 --- a/examples/s4u/io/s4u_io.cpp +++ b/examples/s4u/io/s4u_io.cpp @@ -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); - */ } }; diff --git a/examples/simdag/fail/sd_fail.c b/examples/simdag/fail/sd_fail.c index 30c3b750aa..995932aded 100644 --- a/examples/simdag/fail/sd_fail.c +++ b/examples/simdag/fail/sd_fail.c @@ -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"); diff --git a/src/kernel/activity/SynchroComm.cpp b/src/kernel/activity/SynchroComm.cpp index 43675366c7..72350ad811 100644 --- a/src/kernel/activity/SynchroComm.cpp +++ b/src/kernel/activity/SynchroComm.cpp @@ -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; -- 2.20.1