From: Martin Quinson Date: Sat, 24 Jun 2017 17:29:35 +0000 (+0200) Subject: please codacy X-Git-Tag: v3_17~519 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ab7f502f0c4daa4492ab37ef6f8bd6f3d7460268 please codacy --- diff --git a/examples/msg/actions-storage/actions-storage.c b/examples/msg/actions-storage/actions-storage.c index 815b7ce0d7..0411b63a1c 100644 --- a/examples/msg/actions-storage/actions-storage.c +++ b/examples/msg/actions-storage/actions-storage.c @@ -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); diff --git a/examples/msg/cloud-simple/cloud-simple.c b/examples/msg/cloud-simple/cloud-simple.c index 74d131432b..6f9d25d231 100644 --- a/examples/msg/cloud-simple/cloud-simple.c +++ b/examples/msg/cloud-simple/cloud-simple.c @@ -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; diff --git a/examples/msg/process-suspend/process-suspend.c b/examples/msg/process-suspend/process-suspend.c index e38551738b..19184ef69a 100644 --- a/examples/msg/process-suspend/process-suspend.c +++ b/examples/msg/process-suspend/process-suspend.c @@ -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!!!!"); diff --git a/src/smpi/smpi_pmpi.cpp b/src/smpi/smpi_pmpi.cpp index 635e0d77df..4c68e80ff1 100644 --- a/src/smpi/smpi_pmpi.cpp +++ b/src/smpi/smpi_pmpi.cpp @@ -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; diff --git a/src/xbt/automaton/automaton.c b/src/xbt/automaton/automaton.c index 008ead8886..44c5d96ffa 100644 --- a/src/xbt/automaton/automaton.c +++ b/src/xbt/automaton/automaton.c @@ -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; diff --git a/src/xbt/automaton/automatonparse_promela.c b/src/xbt/automaton/automatonparse_promela.c index 047079c1ce..dffb34e9e9 100644 --- a/src/xbt/automaton/automatonparse_promela.c +++ b/src/xbt/automaton/automatonparse_promela.c @@ -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); }