[Rpm-maint] [rpm-software-management/rpm] Add a rpmKeyring iterator (PR #3365)
Panu Matilainen
notifications at github.com
Fri Oct 11 06:17:45 UTC 2024
@pmatilai commented on this pull request.
> @@ -61,6 +69,55 @@ rpmKeyring rpmKeyringFree(rpmKeyring keyring)
return NULL;
}
+rpmKeyringIterator rpmKeyringInitIterator(rpmKeyring keyring, int unused)
+{
+ if (!keyring || unused != 0)
+ return NULL;
+
+ keyring = rpmKeyringLink(keyring);
+
+ rpmKeyringIterator iter = new rpmKeyringIterator_s {};
+ iter->keyringlock = new rdlock(keyring->mutex);
+ iter->iterator = keyring->keys.cbegin();
+ iter->keyring = keyring;
+ iter->current = NULL;
Yup, the codebase isn't an example of how to do stuff in C++.
I wouldn't have asked for it otherwise at all, but in this particular case it actually makes a difference: doing it like this allows you to take the lock right on construction.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3365#discussion_r1796472384
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/3365/review/2362030767 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241010/ad1a4c6d/attachment.html>
More information about the Rpm-maint
mailing list