From fea8c7d181babe6de7daedfef07b291f8dda2322 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 24 Jun 2018 21:21:56 +0200 Subject: [PATCH] Tweak previous gnutls change for efficiency * src/gnutls.c (Fgnutls_peer_status): Minor optimisation to avoid computing the topmost certificate twice. --- src/gnutls.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gnutls.c b/src/gnutls.c index 5a178472ceb..92956923db3 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1268,18 +1268,16 @@ The return value is a property list with top-level keys :warnings and { Lisp_Object certs = Qnil; - /* Return the host certificate in its own element for - compatibility reasons. */ - result = nconc2 (result, list2 - (intern (":certificate"), - gnutls_certificate_details (XPROCESS (proc)->gnutls_certificates[0]))); - /* Return all the certificates in a list. */ for (int i = 0; i < XPROCESS (proc)->gnutls_certificates_length; i++) certs = nconc2 (certs, list1 (gnutls_certificate_details (XPROCESS (proc)->gnutls_certificates[i]))); result = nconc2 (result, list2 (intern (":certificates"), certs)); + + /* Return the host certificate in its own element for + compatibility reasons. */ + result = nconc2 (result, list2 (intern (":certificate"), XCAR (certs))); } state = XPROCESS (proc)->gnutls_state; -- 2.39.5