Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't hide variables with multiple declarations.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 21 Feb 2012 15:50:01 +0000 (16:50 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 21 Feb 2012 15:50:01 +0000 (16:50 +0100)
src/simdag/sd_daxloader.c
src/surf/cpu_cas01.c
src/surf/surf_routing_floyd.c
src/xbt/backtrace_linux.c
src/xbt/dict.c

index 684f656..ef0b9ee 100644 (file)
@@ -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
index 3755de9..b8dbf22 100644 (file)
@@ -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;
 
index ea030ea..4d71a22 100644 (file)
@@ -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 */
index 4fc1ebc..9704bc0 100644 (file)
@@ -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);
index 226c5d1..b66c85a 100644 (file)
@@ -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++) {