[PATCH 08/14] ir-priv: Pass shared_ptr parameters by copy to type_topo_comp functor

Dodji Seketeli dodji@seketeli.org
Fri Sep 25 21:06:02 GMT 2026


When looking at some potential data race report, I figured it'd be
better to pass the shared_ptr parameters to the type_topo_comp
functor by value, to avoid potential race conditions when the same
shared_ptr is accessed by several threads at the same time.

	* src/abg-ir-priv.h (type_topo_comp::operator()): Pass parameters
	by value.

Signed-off-by: Dodji Seketeli <dodji@seketeli.org>
---
 src/abg-ir-priv.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/abg-ir-priv.h b/src/abg-ir-priv.h
index 4166ba5a..f04fdfe9 100644
--- a/src/abg-ir-priv.h
+++ b/src/abg-ir-priv.h
@@ -1368,8 +1368,8 @@ struct decl_topo_comp
   ///
   /// @return true iff @p f is less than @p s.
   bool
-  operator()(const decl_base_sptr &f,
-	     const decl_base_sptr &s)
+  operator()(const decl_base_sptr f,
+	     const decl_base_sptr s)
   {return operator()(f.get(), s.get());}
 
 }; // end struct decl_topo_comp
@@ -1416,12 +1416,12 @@ struct type_topo_comp
   ///
   /// @return true iff @p f is less than @p s.
   bool
-  operator()(const type_base_sptr &f,
-	     const type_base_sptr &s)
+  operator()(const type_base_sptr f,
+	     const type_base_sptr s)
   {return operator()(f.get(), s.get());}
 
   bool
-  operator()(const type_base_wptr& f, const type_base_wptr& s)
+  operator()(const type_base_wptr f, const type_base_wptr s)
   {
     type_base_sptr first(f), second(s);
     return operator()(first, second);
@@ -1687,13 +1687,13 @@ struct sort_for_hash_functor
   ///
   /// @param s the second operand to consider.
   bool
-  operator()(const type_base_sptr& f, const type_base_sptr& s)
+  operator()(const type_base_sptr f, const type_base_sptr s)
   {
     return operator()(f.get(), s.get());
   }
 
   bool
-  operator()(const type_base_wptr& f, const type_base_wptr& s)
+  operator()(const type_base_wptr f, const type_base_wptr s)
   {
     type_base_sptr first(f), second(s);
     return operator()(first, second);
-- 
2.55.0



More information about the Libabigail mailing list