diff options
| author | Ted Zlatanov | 2014-12-11 17:55:36 -0500 |
|---|---|---|
| committer | Ted Zlatanov | 2014-12-11 17:55:36 -0500 |
| commit | 301a4014a72964a8ec0078055c273d045d94fe42 (patch) | |
| tree | 56624b7953a40c098299261e283fc33200d5f21e /src | |
| parent | d76b9b2a213fa4e2c812a2c2503b4bfa4c28ece8 (diff) | |
| download | emacs-301a4014a72964a8ec0078055c273d045d94fe42.tar.gz emacs-301a4014a72964a8ec0078055c273d045d94fe42.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/gnutls.c | 56 | ||||
| -rw-r--r-- | src/gnutls.h | 4 |
4 files changed, 48 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b8663bcf7c0..90139535e30 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2014-12-11 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * emacs.c (main): Always include gnutls.h and run syms_of_gnutls. | ||
| 4 | |||
| 5 | * gnutls.h: Always declare syms_of_gnutls. | ||
| 6 | |||
| 7 | * gnutls.c (Fgnutls_available_p syms_of_gnutls): Move later for | ||
| 8 | clarity. Let the availability check return Qnil when the GnuTLS | ||
| 9 | integration is not available, instead of erroring out. | ||
| 10 | (Bug#19346) | ||
| 11 | |||
| 1 | 2014-12-10 Eli Zaretskii <eliz@gnu.org> | 12 | 2014-12-10 Eli Zaretskii <eliz@gnu.org> |
| 2 | 13 | ||
| 3 | * xdisp.c (move_it_in_display_line_to, display_line): Don't | 14 | * xdisp.c (move_it_in_display_line_to, display_line): Don't |
diff --git a/src/emacs.c b/src/emacs.c index 4c3857e698d..7367e0d35ea 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/>. */ | |||
| 82 | #include "syntax.h" | 82 | #include "syntax.h" |
| 83 | #include "systime.h" | 83 | #include "systime.h" |
| 84 | 84 | ||
| 85 | #ifdef HAVE_GNUTLS | ||
| 86 | #include "gnutls.h" | 85 | #include "gnutls.h" |
| 87 | #endif | ||
| 88 | 86 | ||
| 89 | #if (defined PROFILING \ | 87 | #if (defined PROFILING \ |
| 90 | && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) | 88 | && (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 | |||
| 1502 | syms_of_fontset (); | 1500 | syms_of_fontset (); |
| 1503 | #endif /* HAVE_NS */ | 1501 | #endif /* HAVE_NS */ |
| 1504 | 1502 | ||
| 1505 | #ifdef HAVE_GNUTLS | ||
| 1506 | syms_of_gnutls (); | 1503 | syms_of_gnutls (); |
| 1507 | #endif | ||
| 1508 | 1504 | ||
| 1509 | #ifdef HAVE_GFILENOTIFY | 1505 | #ifdef HAVE_GFILENOTIFY |
| 1510 | syms_of_gfilenotify (); | 1506 | syms_of_gfilenotify (); |
diff --git a/src/gnutls.c b/src/gnutls.c index 03c29d03014..d1713d379a9 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -673,27 +673,6 @@ See also `gnutls-init'. */) | |||
| 673 | return emacs_gnutls_deinit (proc); | 673 | return emacs_gnutls_deinit (proc); |
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, | ||
| 677 | doc: /* Return t if GnuTLS is available in this instance of Emacs. */) | ||
| 678 | (void) | ||
| 679 | { | ||
| 680 | #ifdef WINDOWSNT | ||
| 681 | Lisp_Object found = Fassq (Qgnutls_dll, Vlibrary_cache); | ||
| 682 | if (CONSP (found)) | ||
| 683 | return XCDR (found); | ||
| 684 | else | ||
| 685 | { | ||
| 686 | Lisp_Object status; | ||
| 687 | status = init_gnutls_functions () ? Qt : Qnil; | ||
| 688 | Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); | ||
| 689 | return status; | ||
| 690 | } | ||
| 691 | #else | ||
| 692 | return Qt; | ||
| 693 | #endif | ||
| 694 | } | ||
| 695 | |||
| 696 | |||
| 697 | /* Initializes global GnuTLS state to defaults. | 676 | /* Initializes global GnuTLS state to defaults. |
| 698 | Call `gnutls-global-deinit' when GnuTLS usage is no longer needed. | 677 | Call `gnutls-global-deinit' when GnuTLS usage is no longer needed. |
| 699 | Returns zero on success. */ | 678 | Returns zero on success. */ |
| @@ -1179,6 +1158,26 @@ This function may also return `gnutls-e-again', or | |||
| 1179 | return gnutls_make_error (ret); | 1158 | return gnutls_make_error (ret); |
| 1180 | } | 1159 | } |
| 1181 | 1160 | ||
| 1161 | DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, | ||
| 1162 | doc: /* Return t if GnuTLS is available in this instance of Emacs. */) | ||
| 1163 | (void) | ||
| 1164 | { | ||
| 1165 | #ifdef WINDOWSNT | ||
| 1166 | Lisp_Object found = Fassq (Qgnutls_dll, Vlibrary_cache); | ||
| 1167 | if (CONSP (found)) | ||
| 1168 | return XCDR (found); | ||
| 1169 | else | ||
| 1170 | { | ||
| 1171 | Lisp_Object status; | ||
| 1172 | status = init_gnutls_functions () ? Qt : Qnil; | ||
| 1173 | Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); | ||
| 1174 | return status; | ||
| 1175 | } | ||
| 1176 | #else | ||
| 1177 | return Qt; | ||
| 1178 | #endif | ||
| 1179 | } | ||
| 1180 | |||
| 1182 | void | 1181 | void |
| 1183 | syms_of_gnutls (void) | 1182 | syms_of_gnutls (void) |
| 1184 | { | 1183 | { |
| @@ -1233,4 +1232,19 @@ are as per the GnuTLS logging conventions. */); | |||
| 1233 | global_gnutls_log_level = 0; | 1232 | global_gnutls_log_level = 0; |
| 1234 | } | 1233 | } |
| 1235 | 1234 | ||
| 1235 | #else | ||
| 1236 | |||
| 1237 | DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0, | ||
| 1238 | doc: /* Return t if GnuTLS is available in this instance of Emacs. */) | ||
| 1239 | (void) | ||
| 1240 | { | ||
| 1241 | return Qnil; | ||
| 1242 | } | ||
| 1243 | |||
| 1244 | void | ||
| 1245 | syms_of_gnutls (void) | ||
| 1246 | { | ||
| 1247 | defsubr (&Sgnutls_available_p); | ||
| 1248 | } | ||
| 1249 | |||
| 1236 | #endif /* HAVE_GNUTLS */ | 1250 | #endif /* HAVE_GNUTLS */ |
diff --git a/src/gnutls.h b/src/gnutls.h index 8a667c00568..8a18976cf1b 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); | |||
| 82 | #endif | 82 | #endif |
| 83 | extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); | 83 | extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); |
| 84 | 84 | ||
| 85 | extern void syms_of_gnutls (void); | ||
| 86 | |||
| 87 | #endif | 85 | #endif |
| 88 | 86 | ||
| 87 | extern void syms_of_gnutls (void); | ||
| 88 | |||
| 89 | #endif | 89 | #endif |