-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
int refcount;
};
-typedef s_smpi_key_elem_t* smpi_key_elem;
+using smpi_key_elem = s_smpi_key_elem_t*;
namespace simgrid{
namespace smpi{
template <typename T>
int Keyval::keyval_create(const smpi_copy_fn& copy_fn, const smpi_delete_fn& delete_fn, int* keyval, void* extra_state)
{
- smpi_key_elem value = new s_smpi_key_elem_t;
+ auto* value = new s_smpi_key_elem_t;
value->copy_fn=copy_fn;
value->delete_fn=delete_fn;
/* See MPI-1, 5.7.1. Freeing the keyval does not remove it if it
* is in use in an attribute */
smpi_key_elem elem = T::keyvals_.at(*keyval);
- if(elem==0){
+ if (elem == nullptr) {
return MPI_ERR_ARG;
}
if(elem->refcount==1){
}else{
elem->refcount--;
}
+ *keyval = MPI_KEYVAL_INVALID;
return MPI_SUCCESS;
}