Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / mc / compare.cpp
index d72827b..72113c8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-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. */
@@ -137,25 +137,23 @@ static ssize_t heap_comparison_ignore_size(const std::vector<simgrid::mc::Ignore
                                            const void* address)
 {
   auto pos = std::lower_bound(ignore_list->begin(), ignore_list->end(), address,
-                              [](auto const& reg, const void* address) { return reg.address < address; });
+                              [](auto const& reg, auto const* addr) { return reg.address < addr; });
   return (pos != ignore_list->end() && pos->address == address) ? pos->size : -1;
 }
 
 static bool is_stack(const void *address)
 {
-  for (auto const& stack : mc_model_checker->get_remote_simulation().stack_areas())
-    if (address == stack.address)
-      return true;
-  return false;
+  auto const& stack_areas = mc_model_checker->get_remote_simulation().stack_areas();
+  return std::any_of(stack_areas.begin(), stack_areas.end(),
+                     [address](auto const& stack) { return stack.address == address; });
 }
 
 // TODO, this should depend on the snapshot?
 static bool is_block_stack(int block)
 {
-  for (auto const& stack : mc_model_checker->get_remote_simulation().stack_areas())
-    if (block == stack.block)
-      return true;
-  return false;
+  auto const& stack_areas = mc_model_checker->get_remote_simulation().stack_areas();
+  return std::any_of(stack_areas.begin(), stack_areas.end(),
+                     [block](auto const& stack) { return stack.block == block; });
 }
 
 namespace simgrid {