]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak previous gnutls change for efficiency
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 24 Jun 2018 19:21:56 +0000 (21:21 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 24 Jun 2018 19:21:56 +0000 (21:21 +0200)
* src/gnutls.c (Fgnutls_peer_status): Minor optimisation to avoid
computing the topmost certificate twice.

src/gnutls.c

index 5a178472ceb977c1523b90fb40e6ea45caf2ec85..92956923db3d3c41a86249aed266ca364f0c6329 100644 (file)
@@ -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;