From 73403a8ba00303b95c0e39fe3d2b78c913b0ca98 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 21 May 2024 10:59:43 +0200 Subject: [PATCH] core: speedup gpgme_get_key * src/engine.c (_gpgme_set_engine_info): Change engine_get_version. -- GnuPG-bug-id: 6369 --- NEWS | 2 +- configure.ac | 4 ++-- src/engine.c | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 415c944c..f2e715f1 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.23.3 (unrelease) +Noteworthy changes in version 1.24.0 (unrelease) ------------------------------------------------- * Extended gpgme_op_decrypt* and gpgme_op_verify* to allow writing the diff --git a/configure.ac b/configure.ac index 92cfacf2..9fa32255 100644 --- a/configure.ac +++ b/configure.ac @@ -31,8 +31,8 @@ min_automake_version="1.14" # for the LT versions. m4_define([mym4_package],[gpgme]) m4_define([mym4_major], [1]) -m4_define([mym4_minor], [23]) -m4_define([mym4_micro], [3]) +m4_define([mym4_minor], [24]) +m4_define([mym4_micro], [0]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a diff --git a/src/engine.c b/src/engine.c index 69f1c150..252d8805 100644 --- a/src/engine.c +++ b/src/engine.c @@ -449,9 +449,16 @@ _gpgme_set_engine_info (gpgme_engine_info_t info, gpgme_protocol_t proto, new_home_dir = NULL; } - new_version = engine_get_version (proto, new_file_name); + if (info && info->version + && ((!info->file_name && !new_file_name) + || (info->file_name && new_file_name + && !strcmp (info->file_name, new_file_name)))) + new_version = strdup (info->version); + else + new_version = engine_get_version (proto, new_file_name); if (!new_version) { + /* Note that we also get here on a ENOMEM in strdup. */ new_version = strdup ("1.0.0"); /* Fake one for dummy entries. */ if (!new_version) {