Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No need to test for attributes()->empty().
[simgrid.git] / src / smpi / include / smpi_keyvals.hpp
index e2f9662..2c93473 100644 (file)
@@ -117,10 +117,7 @@ template <typename T> int Keyval::attr_get(int keyval, void* attr_value, int* fl
   const s_smpi_key_elem_t* elem = T::keyvals_.at(keyval);
   if(elem==nullptr)
     return MPI_ERR_ARG;
-  if(attributes()->empty()){
-    *flag=0;
-    return MPI_SUCCESS;
-  }
+
   const auto& attribs = attributes();
   auto attr           = attribs->find(keyval);
   if (attr != attribs->end()) {
@@ -150,19 +147,17 @@ template <typename T> int Keyval::attr_put(int keyval, void* attr_value){
 }
 
 template <typename T> void Keyval::cleanup_attr(){
-  if (not attributes()->empty()) {
-    int flag=0;
-    for (auto const& it : attributes_) {
-      auto elm = T::keyvals_.find(it.first);
-      if (elm != T::keyvals_.end()) {
-        smpi_key_elem elem = elm->second;
-        if(elem != nullptr){
-          call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
-        }
-      } else {
-        // already deleted, not a problem
-        flag=0;
+  int flag = 0;
+  for (auto const& it : attributes_) {
+    auto elm = T::keyvals_.find(it.first);
+    if (elm != T::keyvals_.end()) {
+      smpi_key_elem elem = elm->second;
+      if (elem != nullptr) {
+        call_deleter<T>((T*)this, elem, it.first, it.second, &flag);
       }
+    } else {
+      // already deleted, not a problem
+      flag = 0;
     }
   }
 }