summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-01-03 23:27:45 +0000
committerCarl Hetherington <cth@carlh.net>2022-01-03 23:28:09 +0000
commita91bea661cc505211d97e3905b30fd1f629f2a06 (patch)
tree1848e6b5fe8e62c71d457085b36d95e71df3d509 /src
parent57b4063573a6a4272a4283617dc6a6e2aba29303 (diff)
Simplify the implementation of DCP::add.
Diffstat (limited to 'src')
-rw-r--r--src/dcp.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 3316b60e..05c93b54 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -363,13 +363,10 @@ DCP::all_encrypted () const
void
DCP::add (DecryptedKDM const & kdm)
{
- auto keys = kdm.keys ();
-
- for (auto i: cpls()) {
- for (auto const& j: kdm.keys()) {
- if (j.cpl_id() == i->id()) {
- i->add (kdm);
- }
+ auto keys = kdm.keys();
+ for (auto cpl: cpls()) {
+ if (std::any_of(keys.begin(), keys.end(), [cpl](DecryptedKDMKey const& key) { return key.cpl_id() == cpl->id(); })) {
+ cpl->add (kdm);
}
}
}