Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use the init-statement to declare variables inside the if statement (sonar).
[simgrid.git] / src / smpi / mpi / smpi_info.cpp
index b969e2a..dfcc335 100644 (file)
@@ -33,8 +33,7 @@ void Info::unref(Info* info){
 int Info::get(const char* key, int valuelen, char* value, int* flag) const
 {
   *flag=false;
-  auto val = map_.find(key);
-  if (val != map_.end()) {
+  if (auto val = map_.find(key); val != map_.end()) {
     std::string tmpvalue = val->second;
 
     memset(value, 0, valuelen);
@@ -74,8 +73,7 @@ int Info::get_nthkey(int n, char* key) const
 int Info::get_valuelen(const char* key, int* valuelen, int* flag) const
 {
   *flag=false;
-  auto val = map_.find(key);
-  if (val != map_.end()) {
+  if (auto val = map_.find(key); val != map_.end()) {
     *valuelen = val->second.length();
     *flag=true;
   }