From 4993faf725da410b064124c820a86a7736b861ac Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 21 Feb 2012 16:50:01 +0100 Subject: [PATCH] Don't hide variables with multiple declarations. --- src/simdag/sd_daxloader.c | 11 ++++------- src/surf/cpu_cas01.c | 2 -- src/surf/surf_routing_floyd.c | 2 +- src/xbt/backtrace_linux.c | 5 ++--- src/xbt/dict.c | 2 +- 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/simdag/sd_daxloader.c b/src/simdag/sd_daxloader.c index 684f656f0c..ef0b9eeaf7 100644 --- a/src/simdag/sd_daxloader.c +++ b/src/simdag/sd_daxloader.c @@ -312,12 +312,11 @@ xbt_dynar_t SD_daxload(const char *filename) xbt_dict_foreach(files, cursor, name, file) { unsigned int cpt1, cpt2; - SD_task_t newfile = NULL; + SD_task_t newfile; SD_dependency_t depbefore, depafter; if (xbt_dynar_is_empty(file->tasks_before)) { xbt_dynar_foreach(file->tasks_after, cpt2, depafter) { - SD_task_t newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, root_task, newfile); SD_task_dependency_add(NULL, NULL, newfile, depafter->dst); #ifdef HAVE_TRACING @@ -333,8 +332,7 @@ xbt_dynar_t SD_daxload(const char *filename) } } else if (xbt_dynar_is_empty(file->tasks_after)) { xbt_dynar_foreach(file->tasks_before, cpt2, depbefore) { - SD_task_t newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, depbefore->src, newfile); SD_task_dependency_add(NULL, NULL, newfile, end_task); #ifdef HAVE_TRACING @@ -356,8 +354,7 @@ xbt_dynar_t SD_daxload(const char *filename) ("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.", file->name, depbefore->src->name); } - newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, depbefore->src, newfile); SD_task_dependency_add(NULL, NULL, newfile, depafter->dst); #ifdef HAVE_TRACING diff --git a/src/surf/cpu_cas01.c b/src/surf/cpu_cas01.c index 3755de922a..b8dbf22d60 100644 --- a/src/surf/cpu_cas01.c +++ b/src/surf/cpu_cas01.c @@ -434,8 +434,6 @@ static void cpu_update_resource_state(void *id, cpu->state_current = SURF_RESOURCE_ON; else { lmm_constraint_t cnst = cpu->constraint; - lmm_variable_t var = NULL; - lmm_element_t elem = NULL; cpu->state_current = SURF_RESOURCE_OFF; diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index ea030ea1fd..4d71a2273d 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -248,7 +248,6 @@ void model_floyd_parse_route(AS_t rc, const char *src, /* set the size of table routing */ size_t table_size = xbt_dict_length(rc->to_index); int *src_id, *dst_id; - int i,j; src_id = xbt_dict_get_or_null(rc->to_index, src); dst_id = xbt_dict_get_or_null(rc->to_index, dst); @@ -258,6 +257,7 @@ void model_floyd_parse_route(AS_t rc, const char *src, if(!as->link_table) { + int i,j; /* Create Cost, Predecessor and Link tables */ as->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */ as->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */ diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 4fc1ebc6f4..9704bc0560 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -94,7 +94,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im /* to extract the addresses from the backtrace */ char **addrs; - char buff[256], *p; + char buff[256]; /* To read the output of addr2line */ FILE *pipe; @@ -126,8 +126,6 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im /* build the commandline */ if (stat(xbt_binary_name, &stat_buf)) { /* Damn. binary not in current dir. We'll have to dig the PATH to find it */ - int i; - for (i = 0; environ[i]; i++) { if (!strncmp("PATH=", environ[i], 5)) { xbt_dynar_t path = xbt_str_split(environ[i] + 5, ":"); @@ -170,6 +168,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im addrs = xbt_new(char *, e->used); for (i = 0; i < e->used; i++) { + char *p; /* retrieve this address */ XBT_DEBUG("Retrieving address number %d from '%s'", i, backtrace_syms[i]); snprintf(buff, 256, "%s", strchr(backtrace_syms[i], '[') + 1); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 226c5d1cc7..b66c85abe8 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -1144,7 +1144,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_dict_t head = NULL; int i, j, k; char *key; - void *data; srand((unsigned int) time(NULL)); @@ -1205,6 +1204,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_test_add("Search my %d elements 20 times", NB_ELM); key = xbt_malloc(10); for (i = 0; i < 20; i++) { + void *data; /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ for (j = 0; j < NB_ELM; j++) { -- 2.20.1