Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / mc / compare.cpp
index 82c157c..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. */
@@ -143,19 +143,17 @@ static ssize_t heap_comparison_ignore_size(const std::vector<simgrid::mc::Ignore
 
 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 {