emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 301a401: Always define `gnutls-available-p' even


From: Teodor Zlatanov
Subject: [Emacs-diffs] emacs-24 301a401: Always define `gnutls-available-p' even if GnuTLS is not available.
Date: Thu, 11 Dec 2014 22:55:07 +0000

branch: emacs-24
commit 301a4014a72964a8ec0078055c273d045d94fe42
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Always define `gnutls-available-p' even if GnuTLS is not available.
    
    Fixes: debbugs:19346
    
    * gnutls.c (Fgnutls_available_p syms_of_gnutls): Move later for
    clarity.  Let the availability check return Qnil when the GnuTLS
    integration is not available, instead of erroring out.
    
    * gnutls.h: Always declare syms_of_gnutls.
    
    * emacs.c (main): Always include gnutls.h and run syms_of_gnutls.
---
 src/ChangeLog |   11 +++++++++++
 src/emacs.c   |    4 ----
 src/gnutls.c  |   56 +++++++++++++++++++++++++++++++++++---------------------
 src/gnutls.h  |    4 ++--
 4 files changed, 48 insertions(+), 27 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index b8663bc..9013953 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2014-12-11  Teodor Zlatanov  <address@hidden>
+
+       * emacs.c (main): Always include gnutls.h and run syms_of_gnutls.
+
+       * gnutls.h: Always declare syms_of_gnutls.
+
+       * gnutls.c (Fgnutls_available_p syms_of_gnutls): Move later for
+       clarity.  Let the availability check return Qnil when the GnuTLS
+       integration is not available, instead of erroring out.
+       (Bug#19346)
+
 2014-12-10  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (move_it_in_display_line_to, display_line): Don't
diff --git a/src/emacs.c b/src/emacs.c
index 4c3857e..7367e0d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -82,9 +82,7 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "syntax.h"
 #include "systime.h"
 
-#ifdef HAVE_GNUTLS
 #include "gnutls.h"
-#endif
 
 #if (defined PROFILING \
      && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
@@ -1502,9 +1500,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       syms_of_fontset ();
 #endif /* HAVE_NS */
 
-#ifdef HAVE_GNUTLS
       syms_of_gnutls ();
-#endif
 
 #ifdef HAVE_GFILENOTIFY
       syms_of_gfilenotify ();
diff --git a/src/gnutls.c b/src/gnutls.c
index 03c29d0..d1713d3 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -673,27 +673,6 @@ See also `gnutls-init'.  */)
   return emacs_gnutls_deinit (proc);
 }
 
-DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0,
-       doc: /* Return t if GnuTLS is available in this instance of Emacs.  */)
-     (void)
-{
-#ifdef WINDOWSNT
-  Lisp_Object found = Fassq (Qgnutls_dll, Vlibrary_cache);
-  if (CONSP (found))
-    return XCDR (found);
-  else
-    {
-      Lisp_Object status;
-      status = init_gnutls_functions () ? Qt : Qnil;
-      Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache);
-      return status;
-    }
-#else
-  return Qt;
-#endif
-}
-
-
 /* Initializes global GnuTLS state to defaults.
 Call `gnutls-global-deinit' when GnuTLS usage is no longer needed.
 Returns zero on success.  */
@@ -1179,6 +1158,26 @@ This function may also return `gnutls-e-again', or
   return gnutls_make_error (ret);
 }
 
+DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0,
+       doc: /* Return t if GnuTLS is available in this instance of Emacs.  */)
+     (void)
+{
+#ifdef WINDOWSNT
+  Lisp_Object found = Fassq (Qgnutls_dll, Vlibrary_cache);
+  if (CONSP (found))
+    return XCDR (found);
+  else
+    {
+      Lisp_Object status;
+      status = init_gnutls_functions () ? Qt : Qnil;
+      Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache);
+      return status;
+    }
+#else
+  return Qt;
+#endif
+}
+
 void
 syms_of_gnutls (void)
 {
@@ -1233,4 +1232,19 @@ are as per the GnuTLS logging conventions.  */);
   global_gnutls_log_level = 0;
 }
 
+#else
+
+DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0,
+       doc: /* Return t if GnuTLS is available in this instance of Emacs.  */)
+     (void)
+{
+  return Qnil;
+}
+
+void
+syms_of_gnutls (void)
+{
+  defsubr (&Sgnutls_available_p);
+}
+
 #endif /* HAVE_GNUTLS */
diff --git a/src/gnutls.h b/src/gnutls.h
index 8a667c0..8a18976 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -82,8 +82,8 @@ extern void emacs_gnutls_transport_set_errno 
(gnutls_session_t state, int err);
 #endif
 extern Lisp_Object emacs_gnutls_deinit (Lisp_Object);
 
-extern void syms_of_gnutls (void);
-
 #endif
 
+extern void syms_of_gnutls (void);
+
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]