Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use empty() to check whether the container is empty or not.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 2 Oct 2020 20:04:16 +0000 (22:04 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 2 Oct 2020 20:04:47 +0000 (22:04 +0200)
include/xbt/Extendable.hpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/simix/smx_global.cpp
src/smpi/internals/smpi_global.cpp

index d47298d..75eeeed 100644 (file)
@@ -48,7 +48,7 @@ template<class T>
 class Extendable {
 private:
   static std::vector<void(*)(void*)> deleters_;
-  std::vector<void*> extensions_{(deleters_.size() > 0 ? deleters_.size() : 1), nullptr};
+  std::vector<void*> extensions_{std::max<decltype(deleters_.size())>(1, deleters_.size()), nullptr};
 
 public:
   static size_t extension_create(void (*deleter)(void*))
index 89f2249..47eb9a2 100644 (file)
@@ -106,7 +106,7 @@ static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
   comm_pattern->dst_proc = dst_proc->get_pid();
   comm_pattern->src_host = MC_smx_actor_get_host_name(src_proc);
   comm_pattern->dst_host = MC_smx_actor_get_host_name(dst_proc);
-  if (comm_pattern->data.size() == 0 && comm->src_buff_ != nullptr) {
+  if (comm_pattern->data.empty() && comm->src_buff_ != nullptr) {
     size_t buff_size;
     mc_model_checker->get_remote_simulation().read(&buff_size, remote(comm->dst_buff_size_));
     comm_pattern->data.resize(buff_size);
index 8ae0f08..4e90c3d 100644 (file)
@@ -330,7 +330,7 @@ void SIMIX_clean()
   }
 
 #if HAVE_SMPI
-  if (simix_global->process_list.size() > 0) {
+  if (not simix_global->process_list.empty()) {
     if(smpi_process()->initialized()){
       xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
     }else{
index c2ff4c6..16826b5 100644 (file)
@@ -164,7 +164,7 @@ void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, v
   XBT_DEBUG("Copy the data over");
   if(smpi_is_shared(buff, src_private_blocks, &src_offset)) {
     src_private_blocks = shift_and_frame_private_blocks(src_private_blocks, src_offset, buff_size);
-    if (src_private_blocks.size()==0){//simple shared malloc ... return.
+    if (src_private_blocks.empty()) { // simple shared malloc ... return.
       XBT_VERB("Sender is shared. Let's ignore it.");
       smpi_cleanup_comm_after_copy(comm, buff);
       return;
@@ -176,7 +176,7 @@ void smpi_comm_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, v
   }
   if (smpi_is_shared((char*)comm->dst_buff_, dst_private_blocks, &dst_offset)) {
     dst_private_blocks = shift_and_frame_private_blocks(dst_private_blocks, dst_offset, buff_size);
-    if (dst_private_blocks.size()==0){//simple shared malloc ... return.
+    if (dst_private_blocks.empty()) { // simple shared malloc ... return.
       XBT_VERB("Receiver is shared. Let's ignore it.");
       smpi_cleanup_comm_after_copy(comm, buff);
       return;