Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce scope of variables (please Codacy).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 27 Jul 2017 11:54:02 +0000 (13:54 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 27 Jul 2017 11:54:52 +0000 (13:54 +0200)
src/instr/instr_paje_types.cpp
teshsuite/smpi/coll-alltoallv/coll-alltoallv.c
teshsuite/smpi/coll-scatter/coll-scatter.c

index c93da96..792fc4c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, 2014-2015. The SimGrid Team.
+/* Copyright (c) 2012, 2014-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -142,8 +142,8 @@ type_t PJ_type_variable_new (const char *name, const char *color, type_t father)
 
   type_t ret = nullptr;
 
 
   type_t ret = nullptr;
 
-  char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
   if (not color) {
   if (not color) {
+    char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
     ret = newType (name, name, white, TYPE_VARIABLE, father);
   }else{
     ret = newType (name, name, color, TYPE_VARIABLE, father);
     ret = newType (name, name, white, TYPE_VARIABLE, father);
   }else{
     ret = newType (name, name, color, TYPE_VARIABLE, father);
index 780ee63..30d5a88 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014. The SimGrid Team.
+/* Copyright (c) 2013-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
 
 static void print_buffer_int(void *buf, int len, char *msg, int rank)
 {
 
 static void print_buffer_int(void *buf, int len, char *msg, int rank)
 {
-  int* v;
   printf("[%d] %s (#%d): ", rank, msg, len);
   for (int tmp = 0; tmp < len; tmp++) {
   printf("[%d] %s (#%d): ", rank, msg, len);
   for (int tmp = 0; tmp < len; tmp++) {
-    v = buf;
+    int *v = buf;
     printf("[%d]", v[tmp]);
   }
   printf("\n");
     printf("[%d]", v[tmp]);
   }
   printf("\n");
index 08c2aaf..9f18ddb 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014. The SimGrid Team.
+/* Copyright (c) 2012-2014, 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -15,7 +15,6 @@ int main(int argc, char **argv)
    int retval;
    int sendcount = 1;            // one double to each process
    int recvcount = 1;
    int retval;
    int sendcount = 1;            // one double to each process
    int recvcount = 1;
-   int i;
    double *sndbuf = NULL;
    double rcvd;
    int root = 0;                 // arbitrary choice
    double *sndbuf = NULL;
    double rcvd;
    int root = 0;                 // arbitrary choice
@@ -27,7 +26,7 @@ int main(int argc, char **argv)
    // on root, initialize sendbuf
    if (root == rank) {
      sndbuf = malloc(size * sizeof(double));
    // on root, initialize sendbuf
    if (root == rank) {
      sndbuf = malloc(size * sizeof(double));
-     for (i = 0; i < size; i++) {
+     for (int i = 0; i < size; i++) {
        sndbuf[i] = (double) i;
      }
    }
        sndbuf[i] = (double) i;
      }
    }