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-04-20 20:06:50 +0200
commit3da5ba894243cb65c489f6acbcf4a37095130563 (patch)
tree44416ed64b8059fb5b72ae3cbaec17ad5f0707b9 /src
parentfbf4e083ac834a94167d5d0e3d715206cb736a23 (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);
}
}
}