Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference local variables in src/smpi/.
[simgrid.git] / src / smpi / mpi / smpi_topo.cpp
index 424e349..2dbbcd4 100644 (file)
@@ -80,7 +80,8 @@ Topo_Cart::Topo_Cart(MPI_Comm comm_old, int ndims, const int dims[], const int p
   } else {
     if(comm_cart != nullptr){
       if (rank == 0) {
-        *comm_cart = new  Comm(new  Group(MPI_COMM_SELF->group()), this);
+        MPI_Group group = new Group(MPI_COMM_SELF->group());
+        *comm_cart      = new Comm(group, this);
       } else {
         *comm_cart = MPI_COMM_NULL;
       }
@@ -272,7 +273,7 @@ int Topo_Cart::Dims_create(int nnodes, int ndims, int dims[])
   /* Get # of free-to-be-assigned processes and # of free dimensions */
   int freeprocs = nnodes;
   int freedims = 0;
-  int *p = dims;
+  const int* p  = dims;
   for (int i = 0; i < ndims; ++i) {
     if (*p == 0) {
       ++freedims;