From 41ec02708cdd5e0f2b478a9f5135a597353a72e8 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 27 Jul 2017 13:54:02 +0200 Subject: [PATCH] Reduce scope of variables (please Codacy). --- src/instr/instr_paje_types.cpp | 4 ++-- teshsuite/smpi/coll-alltoallv/coll-alltoallv.c | 5 ++--- teshsuite/smpi/coll-scatter/coll-scatter.c | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index c93da968dc..792fc4ce5e 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -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 @@ -142,8 +142,8 @@ type_t PJ_type_variable_new (const char *name, const char *color, type_t father) type_t ret = nullptr; - char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1"; 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); diff --git a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c index 780ee6354f..30d5a88d16 100644 --- a/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c +++ b/teshsuite/smpi/coll-alltoallv/coll-alltoallv.c @@ -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 @@ -46,10 +46,9 @@ 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++) { - v = buf; + int *v = buf; printf("[%d]", v[tmp]); } printf("\n"); diff --git a/teshsuite/smpi/coll-scatter/coll-scatter.c b/teshsuite/smpi/coll-scatter/coll-scatter.c index 08c2aaf6ea..9f18ddbcfc 100644 --- a/teshsuite/smpi/coll-scatter/coll-scatter.c +++ b/teshsuite/smpi/coll-scatter/coll-scatter.c @@ -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 @@ -15,7 +15,6 @@ int main(int argc, char **argv) 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 @@ -27,7 +26,7 @@ int main(int argc, char **argv) // 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; } } -- 2.20.1