From 95da67852e7c837592a61fb44cd8acd325d16ba2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Oct 2024 15:12:28 +0200 Subject: Minor performance optimization --- libbuild2/target.ixx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libbuild2/target.ixx b/libbuild2/target.ixx index 47dff3d..f8ee975 100644 --- a/libbuild2/target.ixx +++ b/libbuild2/target.ixx @@ -491,12 +491,14 @@ namespace build2 // inline group_prerequisites:: group_prerequisites (const target& t) - : t_ (t), - g_ (t_.group == nullptr || - t_.group->adhoc_member != nullptr || // Ad hoc group member. - t_.group->prerequisites ().empty () - ? nullptr : t_.group) + : t_ (t), g_ (nullptr) { + if (const target* g = t_.group) + { + if (g->adhoc_member == nullptr && // Not ad hoc group member. + !g->prerequisites ().empty ()) + g_ = g; + } } inline group_prerequisites:: -- cgit v1.1