aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package-query.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-06-14 10:52:44 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-06-15 00:15:24 +0300
commit5f2a12b015f957c33a7d8edbd06d2fe3594f8b3b (patch)
treebf5bec28191707154c95a0bee962ba7bf66af674 /bpkg/package-query.cxx
parentb3a192927418670a86f567a51189a82c8e9cd5c0 (diff)
Fix find() to avoid redundant checks
Diffstat (limited to 'bpkg/package-query.cxx')
-rw-r--r--bpkg/package-query.cxx42
1 files changed, 21 insertions, 21 deletions
diff --git a/bpkg/package-query.cxx b/bpkg/package-query.cxx
index ea64e71..9675d97 100644
--- a/bpkg/package-query.cxx
+++ b/bpkg/package-query.cxx
@@ -191,33 +191,33 @@ namespace bpkg
return lrf.load ();
}
}
+ }
- // Finally, load the complements and prerequisites and check them
- // recursively.
- //
- for (const lazy_weak_ptr<repository>& cr: cs)
+ // Finally, load the complements and prerequisites and check them
+ // recursively.
+ //
+ for (const lazy_weak_ptr<repository>& cr: cs)
+ {
+ for (const auto& fr: cr.load ()->fragments)
{
- for (const auto& fr: cr.load ()->fragments)
- {
- // Should we consider prerequisites of our complements as our
- // prerequisites? I'd say not.
- //
- if (shared_ptr<repository_fragment> r =
- find (fr.fragment.load (), ap, chain, false))
- return r;
- }
+ // Should we consider prerequisites of our complements as our
+ // prerequisites? I'd say not.
+ //
+ if (shared_ptr<repository_fragment> r =
+ find (fr.fragment.load (), ap, chain, false))
+ return r;
}
+ }
- if (prereq)
+ if (prereq)
+ {
+ for (const lazy_weak_ptr<repository>& pr: ps)
{
- for (const lazy_weak_ptr<repository>& pr: ps)
+ for (const auto& fr: pr.load ()->fragments)
{
- for (const auto& fr: pr.load ()->fragments)
- {
- if (shared_ptr<repository_fragment> r =
- find (fr.fragment.load (), ap, chain, false))
- return r;
- }
+ if (shared_ptr<repository_fragment> r =
+ find (fr.fragment.load (), ap, chain, false))
+ return r;
}
}
}