From: Martin Quinson Date: Wed, 24 May 2017 12:10:29 +0000 (+0200) Subject: tidy the scope of some more locals X-Git-Tag: v3.16~222 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/23eef5ffa2ad4a1d6a5bed99ed932e2592d47793?hp=999c6ca0248ff66351ef2ebd0901622384212bc6 tidy the scope of some more locals --- diff --git a/examples/msg/network-ns3/network-ns3.c b/examples/msg/network-ns3/network-ns3.c index c422f5c502..390ca97228 100644 --- a/examples/msg/network-ns3/network-ns3.c +++ b/examples/msg/network-ns3/network-ns3.c @@ -11,7 +11,6 @@ int timer_start; //set as 1 in the master process //keep a pointer to all surf running tasks. #define NTASKS 1500 -int bool_printed = 0; double start_time, end_time, elapsed_time; double gl_data_size[NTASKS]; msg_task_t gl_task_array[NTASKS]; @@ -126,9 +125,6 @@ static int worker(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - bool_printed = 0; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]); @@ -142,7 +138,7 @@ int main(int argc, char *argv[]) MSG_launch_application(argv[2]); - res = MSG_main(); + msg_error_t res = MSG_main(); return res != MSG_OK; } diff --git a/examples/smpi/mc/bugged1.c b/examples/smpi/mc/bugged1.c index 8815dd38b0..9abacce696 100644 --- a/examples/smpi/mc/bugged1.c +++ b/examples/smpi/mc/bugged1.c @@ -12,7 +12,7 @@ int main(int argc, char **argv) { - int recv_buff, err, size, rank, i; + int recv_buff, err, size, rank; MPI_Status status; /* Initialize MPI */ @@ -33,7 +33,7 @@ int main(int argc, char **argv) if (rank == 0) { printf("MPI_ISend / MPI_IRecv Test \n"); - for(i=0; i < size - 1; i++){ + for(int i=0; i < size - 1; i++){ MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status); printf("Message received from %d\n", recv_buff); } diff --git a/src/xbt/automaton/automatonparse_promela.c b/src/xbt/automaton/automatonparse_promela.c index 3d83df1cf3..6364fe32e3 100644 --- a/src/xbt/automaton/automatonparse_promela.c +++ b/src/xbt/automaton/automatonparse_promela.c @@ -51,9 +51,8 @@ static void new_state(char* id, int src){ static void new_transition(char* id, xbt_automaton_exp_label_t label) { - xbt_automaton_state_t state_dst = NULL; new_state(id, 0); - state_dst = xbt_automaton_state_exists(parsed_automaton, id); + xbt_automaton_state_t state_dst = xbt_automaton_state_exists(parsed_automaton, id); xbt_automaton_state_t state_src = xbt_automaton_state_exists(parsed_automaton, state_id_src); //xbt_transition_t trans = NULL; diff --git a/src/xbt/log.c b/src/xbt/log.c index 0323fde628..a7379c56cd 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -458,7 +458,6 @@ int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority unsigned int cursor; xbt_log_setting_t setting = NULL; - int found = 0; XBT_DEBUG("Initializing category '%s' (firstChild=%s, nextSibling=%s)", category->name, (category->firstChild ? category->firstChild->name : "none"), @@ -503,6 +502,7 @@ int _xbt_log_cat_init(xbt_log_category_t category, e_xbt_log_priority_t priority if (xbt_log_settings) { xbt_assert(category, "NULL category"); xbt_assert(category->name); + int found = 0; xbt_dynar_foreach(xbt_log_settings, cursor, setting) { xbt_assert(setting, "Damnit, NULL cat in the list");