all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Fgnutls_available_p: Avoid duplicating capabilities.
@ 2022-11-03  3:21 Juanma Barranquero
  2022-11-03  3:31 ` Juanma Barranquero
  2022-11-03  8:05 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Juanma Barranquero @ 2022-11-03  3:21 UTC (permalink / raw)
  To: Emacs developers

[-- 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 --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-03  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03  3:21 Fgnutls_available_p: Avoid duplicating capabilities Juanma Barranquero
2022-11-03  3:31 ` Juanma Barranquero
2022-11-03  3:44   ` Juanma Barranquero
2022-11-03  8:05 ` Eli Zaretskii

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.