all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Fgnutls_available_p: Avoid duplicating capabilities.
Date: Thu, 3 Nov 2022 04:21:47 +0100	[thread overview]
Message-ID: <CAAeL0SSCFA37VWrhMGyw=FYJbY1_zPkA_oktmZ-zB7=tz-mJ9w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]

gnutls-available-p can return duplicate capabilities; on my system, for
example, 'ClientHello Padding' appears twice.

Ok to commit?

* src/gnutls.c (Fgnutls_available_p): Avoid duplicating capabilities.

---
 src/gnutls.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gnutls.c b/src/gnutls.c
index a0de0238c4..2840c2abe9 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2801,22 +2801,24 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p,
Sgnutls_available_p, 0, 0, 0,

   capabilities = Fcons (intern("macs"), capabilities);

+#  ifdef HAVE_GNUTLS_EXT__DUMBFW
+  capabilities = Fcons (intern("ClientHello Padding"), capabilities);
+#  endif
+
 #  ifdef HAVE_GNUTLS_EXT_GET_NAME
   for (unsigned int ext=0; ext < 100; ext++)
     {
       const char* name = gnutls_ext_get_name(ext);
       if (name != NULL)
         {
-          capabilities = Fcons (intern(name), capabilities);
+          Lisp_Object cap = intern (name);
+          if (NILP (Fmemq (cap, capabilities)))
+            capabilities = Fcons (cap, capabilities);
         }
     }
 #  endif
 # endif  /* HAVE_GNUTLS3 */

-#  ifdef HAVE_GNUTLS_EXT__DUMBFW
-  capabilities = Fcons (intern("ClientHello Padding"), capabilities);
-#  endif
-
 # ifdef WINDOWSNT
   Vlibrary_cache = Fcons (Fcons (Qgnutls, capabilities), Vlibrary_cache);
 # endif /* WINDOWSNT */
-- 
2.38.1.windows.1

[-- Attachment #2: Type: text/html, Size: 1739 bytes --]

             reply	other threads:[~2022-11-03  3:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03  3:21 Juanma Barranquero [this message]
2022-11-03  3:31 ` Fgnutls_available_p: Avoid duplicating capabilities Juanma Barranquero
2022-11-03  3:44   ` Juanma Barranquero
2022-11-03  8:05 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0SSCFA37VWrhMGyw=FYJbY1_zPkA_oktmZ-zB7=tz-mJ9w@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.