Преглед изворни кода

reduce variable scope when possible

Nathalie Furmento пре 8 година
родитељ
комит
b3fbfe6bb1

+ 2 - 2
examples/spmv/dw_block_spmv.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2012, 2014-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -176,7 +176,6 @@ void launch_spmv_codelets(void)
 {
 	struct starpu_task *task_tab;
 	uint8_t *is_entry_tab;
-	int ret;
 
 	/* we call one codelet per block */
 	unsigned nblocks = starpu_bcsr_get_nnz(sparse_matrix);
@@ -263,6 +262,7 @@ void launch_spmv_codelets(void)
 	unsigned task;
 	for (task = 0; task < totaltasks; task++)
 	{
+		int ret;
 		if (is_entry_tab[task])
 		{
 			nchains++;

+ 2 - 2
mpi/src/load_balancer/policy/load_heat_propagation.c

@@ -96,14 +96,14 @@ static void balance(starpu_data_handle_t load_data_cpy)
 {
 	int less_loaded = -1;
 	int n;
-	double elapsed_time, ref_elapsed_time;
+	double ref_elapsed_time;
 	double my_elapsed_time = load_data_get_elapsed_time(load_data_cpy);
 
 	/* Search for the less loaded neighbor */
 	ref_elapsed_time = my_elapsed_time;
 	for (n = 0; n < nneighbors; n++)
 	{
-		elapsed_time = load_data_get_elapsed_time(neighbor_load_data_handles[n]);
+		double elapsed_time = load_data_get_elapsed_time(neighbor_load_data_handles[n]);
 		if (ref_elapsed_time > elapsed_time)
 		{
 			//fprintf(stderr,"Node%d: ref local time %lf vs neighbour%d time %lf\n", my_rank, ref_elapsed_time, neighbor_ids[n], elapsed_time);

+ 2 - 2
mpi/tests/insert_task_sent_cache.c

@@ -138,7 +138,7 @@ void test_cache(int rank, char *enabled, size_t *comm_amount)
 
 int main(int argc, char **argv)
 {
-	int dst, rank, size;
+	int rank, size;
 	int result=0;
 	size_t *comm_amount_with_cache;
 	size_t *comm_amount_without_cache;
@@ -157,7 +157,7 @@ int main(int argc, char **argv)
 
 	if (rank == 0 || rank == 1)
 	{
-		dst = (rank == 0) ? 1 : 0;
+		int dst = (rank == 0) ? 1 : 0;
 		result = (comm_amount_with_cache[dst] == comm_amount_without_cache[dst] * 5);
 		FPRINTF_MPI(stderr, "Communication cache mechanism is %sworking\n", result?"":"NOT ");
 	}