Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 24 Jun 2017 17:29:35 +0000 (19:29 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 24 Jun 2017 17:29:35 +0000 (19:29 +0200)
examples/msg/actions-storage/actions-storage.c
examples/msg/cloud-simple/cloud-simple.c
examples/msg/process-suspend/process-suspend.c
src/smpi/smpi_pmpi.cpp
src/xbt/automaton/automaton.c
src/xbt/automaton/automatonparse_promela.c

index 815b7ce..0411b63 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -64,12 +64,11 @@ static void action_open(const char *const *action) {
 static void action_read(const char *const *action) {
   const char *file_name = action[2];
   const char *size_str = action[3];
-  msg_file_t file = NULL;
   sg_size_t size = parse_size(size_str);
 
   double clock = MSG_get_clock();
 
-  file = get_file_descriptor(file_name);
+  msg_file_t file = get_file_descriptor(file_name);
 
   ACT_DEBUG("Entering Read: %s (size: %llu)", NAME, size);
   MSG_file_read(file, size);
index 74d1314..6f9d25d 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -85,10 +84,9 @@ static int communication_rx_fun(int argc, char *argv[])
 static void launch_communication_worker(msg_host_t tx_host, msg_host_t rx_host)
 {
   char *mbox = bprintf("MBOX:%s-%s", MSG_host_get_name(tx_host), MSG_host_get_name(rx_host));
-  char **argv = NULL;
-
   const char *pr_name_tx =  "comm_tx";
-  argv = xbt_new(char *, 3);
+
+  char** argv = xbt_new(char*, 3);
   argv[0] = xbt_strdup(pr_name_tx);
   argv[1] = xbt_strdup(mbox);
   argv[2] = NULL;
index e385517..19184ef 100644 (file)
@@ -35,10 +35,8 @@ static int lazy_guy(int argc, char *argv[])
 /* The Dream master: */
 static int dream_master(int argc, char *argv[])
 {
-  msg_process_t lazy = NULL;
-
   XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */
-  lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
+  msg_process_t lazy = MSG_process_create("Lazy", lazy_guy, NULL, MSG_host_self());
   XBT_INFO("Let's wait a little bit...");
   MSG_process_sleep(10.0);              /* - Wait for 10 seconds */
   XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!");
index 635e0d7..4c68e80 100644 (file)
@@ -2127,8 +2127,7 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     }
 
     extra->datatype1 = encode_datatype(sendtmptype, &known);
-    int dt_size_send = 1;
-    dt_size_send     = sendtmptype->size();
+    int dt_size_send = sendtmptype->size();
 
     for (i = 0; i < size; i++) { // copy data to avoid bad free
       extra->send_size += sendtmpcounts[i] * dt_size_send;
index 008ead8..44c5d96 100644 (file)
@@ -21,8 +21,7 @@ struct xbt_automaton_propositional_symbol{
 };
 
 xbt_automaton_t xbt_automaton_new(void){
-  xbt_automaton_t automaton = NULL;
-  automaton = xbt_new0(struct xbt_automaton, 1);
+  xbt_automaton_t automaton = xbt_new0(struct xbt_automaton, 1);
   automaton->states = xbt_dynar_new(sizeof(xbt_automaton_state_t), xbt_automaton_state_free_voidp);
   automaton->transitions = xbt_dynar_new(sizeof(xbt_automaton_transition_t), xbt_automaton_transition_free_voidp);
   automaton->propositional_symbols = xbt_dynar_new(sizeof(xbt_automaton_propositional_symbol_t), xbt_automaton_propositional_symbol_free_voidp);
@@ -30,8 +29,7 @@ xbt_automaton_t xbt_automaton_new(void){
 }
 
 xbt_automaton_state_t xbt_automaton_state_new(xbt_automaton_t a, int type, char* id){
-  xbt_automaton_state_t state = NULL;
-  state = xbt_new0(struct xbt_automaton_state, 1);
+  xbt_automaton_state_t state = xbt_new0(struct xbt_automaton_state, 1);
   state->type = type;
   state->id = xbt_strdup(id);
   state->in = xbt_dynar_new(sizeof(xbt_automaton_transition_t), xbt_automaton_transition_free_voidp);
@@ -41,8 +39,7 @@ xbt_automaton_state_t xbt_automaton_state_new(xbt_automaton_t a, int type, char*
 }
 
 xbt_automaton_transition_t xbt_automaton_transition_new(xbt_automaton_t a, xbt_automaton_state_t src, xbt_automaton_state_t dst, xbt_automaton_exp_label_t label){
-  xbt_automaton_transition_t transition = NULL;
-  transition = xbt_new0(struct xbt_automaton_transition, 1);
+  xbt_automaton_transition_t transition = xbt_new0(struct xbt_automaton_transition, 1);
   if(src != NULL){
     xbt_dynar_push(src->out, &transition);
     transition->src = src;
@@ -205,8 +202,7 @@ static int call_simple_function(void* function)
 }
 
 xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_automaton_t a, const char* id, int(*fct)(void)){
-  xbt_automaton_propositional_symbol_t prop_symb = NULL;
-  prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
+  xbt_automaton_propositional_symbol_t prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
   prop_symb->pred = xbt_strdup(id);
   prop_symb->callback                            = &call_simple_function;
   prop_symb->data = fct;
index 047079c..dffb34e 100644 (file)
@@ -1,7 +1,6 @@
 /* methods for implementation of automaton from promela description */
 
-/* Copyright (c) 2011-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2011-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -33,8 +32,7 @@ static void new_state(char* id, int src){
   }
   free(id_copy);
 
-  xbt_automaton_state_t state = NULL;
-  state = xbt_automaton_state_exists(parsed_automaton, id);
+  xbt_automaton_state_t state = xbt_automaton_state_exists(parsed_automaton, id);
   if(state == NULL){
     state = xbt_automaton_state_new(parsed_automaton, type, id);
   }