* 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
* Re: Fgnutls_available_p: Avoid duplicating capabilities.
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
1 sibling, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2022-11-03 3:31 UTC (permalink / raw)
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
Oops, braino. I accidentally moved the #ifdef HAVE_GNUTLS_EXT__DUMBFW block
inside the HAVE_GNUTLS3 one.
Corrected patch:
diff --git i/src/gnutls.c w/src/gnutls.c
index a0de0238c4..5ee5c984a7 100644
--- i/src/gnutls.c
+++ w/src/gnutls.c
@@ -2791,4 +2791,8 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p,
Sgnutls_available_p, 0, 0, 0,
capabilities = Fcons (intern("gnutls"), capabilities);
+# ifdef HAVE_GNUTLS_EXT__DUMBFW
+ capabilities = Fcons (intern("ClientHello Padding"), capabilities);
+# endif
+
# ifdef HAVE_GNUTLS3
capabilities = Fcons (intern("gnutls3"), capabilities);
@@ -2808,5 +2812,7 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p,
Sgnutls_available_p, 0, 0, 0,
if (name != NULL)
{
- capabilities = Fcons (intern(name), capabilities);
+ Lisp_Object cap = intern (name);
+ if (NILP (Fmemq (cap, capabilities)))
+ capabilities = Fcons (intern(name), capabilities);
}
}
@@ -2814,8 +2820,4 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p,
Sgnutls_available_p, 0, 0, 0,
# 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);
[-- Attachment #2: Type: text/html, Size: 1827 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Fgnutls_available_p: Avoid duplicating capabilities.
2022-11-03 3:31 ` Juanma Barranquero
@ 2022-11-03 3:44 ` Juanma Barranquero
0 siblings, 0 replies; 4+ messages in thread
From: Juanma Barranquero @ 2022-11-03 3:44 UTC (permalink / raw)
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 329 bytes --]
Obviously, this bit in the last patch:
+ if (NILP (Fmemq (cap, capabilities)))
+ capabilities = Fcons (intern(name), capabilities);
was meant to be
+ if (NILP (Fmemq (cap, capabilities)))
+ capabilities = Fcons (cap, capabilities);
Note to self: DO NOT try to make patches at 4:40am.
[-- Attachment #2: Type: text/html, Size: 775 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fgnutls_available_p: Avoid duplicating capabilities.
2022-11-03 3:21 Fgnutls_available_p: Avoid duplicating capabilities Juanma Barranquero
2022-11-03 3:31 ` Juanma Barranquero
@ 2022-11-03 8:05 ` Eli Zaretskii
1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2022-11-03 8:05 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: emacs-devel
> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Thu, 3 Nov 2022 04:21:47 +0100
>
> gnutls-available-p can return duplicate capabilities; on my system, for example, 'ClientHello Padding' appears
> twice.
>
> Ok to commit?
Yes, thanks.
^ permalink raw reply [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.