From 47bdcf6b5d6871dc890bc365c995ff213f608574 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 29 Nov 2012 07:13:00 +0000
Subject: [PATCH] better

---
 Common/GmshMessage.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index f9b256a32c..28c1853d47 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -77,18 +77,18 @@ static int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
 
 void Msg::Init(int argc, char **argv)
 {
-  int sargc = 0;
-  char **sargv = new char*[argc];
 #if defined(HAVE_MPI)
   int flag;
   MPI_Initialized(&flag);
-  if(!flag) MPI_Init(&sargc, &sargv);
+  if(!flag) MPI_Init(&argc, &argv);
   MPI_Comm_rank(MPI_COMM_WORLD, &_commRank);
   MPI_Comm_size(MPI_COMM_WORLD, &_commSize);
   MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
 #endif
 #if defined(HAVE_PETSC)
-  // prune argv from stuff that confuses PETSc
+  int sargc = 0;
+  char **sargv = new char*[argc + 1];
+  // prune argv from gmsh-specific options that make PETSc verbose
   for(int i = 0; i < argc; i++){
     std::string val(argv[i]);
     if(val != "-info" && val != "-help" && val != "-v")
-- 
GitLab