From 174caaa6f53e1125724a47dad3a5c991298aee6d Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Fri, 1 Nov 2019 12:04:41 +0100 Subject: [PATCH] cpp: Minor optimization in remark lookup * lang/cpp/src/key.cpp (UserID::remark): Use C-API. -- The other parts of that function already use the C API so we can also avoid function calls for the keyListMode. --- lang/cpp/src/key.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index eb7a5030..e2d91a10 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -753,8 +753,12 @@ const char *UserID::remark(const Key &remarker, Error &err) const return nullptr; } - if (!(parent().keyListMode() & GPGME_KEYLIST_MODE_SIG_NOTATIONS) || - !(parent().keyListMode() & GPGME_KEYLIST_MODE_SIGS)) { + if (key->protocol != GPGME_PROTOCOL_OpenPGP) { + return nullptr; + } + + if (!(key->keylist_mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS) || + !(key->keylist_mode & GPGME_KEYLIST_MODE_SIGS)) { err = Error::fromCode(GPG_ERR_NO_DATA); return nullptr; }