From 1676e69601ae310165d6172f82dbfaae679def12 Mon Sep 17 00:00:00 2001 From: ueno Date: Wed, 6 Dec 2000 05:59:56 +0000 Subject: [PATCH] * FLIM-ELS: Don't install md5-dl.el, md5-el.el, sha1-dl.el and sha1-el.el if the running emacs has builtin message digest functions. * md5-dl.el, sha1-dl.el: Don't bind `dynamic-link' and `dynamic-call'. * md5.el (md5-dl-module): Moved from md5-dl.el. * sha1.el: Don't bind `sha1-string'. --- FLIM-ELS | 21 +++++++++++++++------ md5-dl.el | 20 +++----------------- md5.el | 17 ++++++++++------- sha1-dl.el | 5 +---- sha1.el | 3 --- 5 files changed, 29 insertions(+), 37 deletions(-) diff --git a/FLIM-ELS b/FLIM-ELS index 2d72a1f..c0a923c 100644 --- a/FLIM-ELS +++ b/FLIM-ELS @@ -14,15 +14,11 @@ sasl sasl-cram sasl-digest smtp qmtp smtpmail)) -(setq flim-version-specific-modules '(mailcap)) - (setq hmac-modules '(hex-util - hmac-def - md5 md5-el md5-dl - sha1 sha1-el sha1-dl + hmac-def md5 sha1 hmac-md5 hmac-sha1)) -(setq flim-modules (nconc hmac-modules flim-modules)) +(setq flim-version-specific-modules '(mailcap)) (if (and (fboundp 'base64-encode-string) (subrp (symbol-function 'base64-encode-string))) @@ -35,4 +31,17 @@ (unless-broken ccl-usable (setq flim-modules (cons 'mel-b-ccl (cons 'mel-q-ccl flim-modules)))) +(if (and (fboundp 'md5) + (subrp (symbol-function 'md5))) + nil + (if (fboundp 'dynamic-link) + (setq hmac-modules (cons 'md5-dl hmac-modules)) + (setq hmac-modules (cons 'md5-el hmac-modules)))) + +(if (fboundp 'dynamic-link) + (setq hmac-modules (cons 'sha1-dl hmac-modules)) + (setq hmac-modules (cons 'sha1-el hmac-modules))) + +(setq flim-modules (nconc hmac-modules flim-modules)) + ;;; FLIM-ELS ends here diff --git a/md5-dl.el b/md5-dl.el index 72078c5..16d2de1 100644 --- a/md5-dl.el +++ b/md5-dl.el @@ -26,19 +26,8 @@ ;;; Code: -(eval-when-compile - (defun-maybe md5-string (a)) - (defun-maybe dynamic-link (a)) - (defun-maybe dynamic-call (a b))) - -(defvar md5-dl-module - (if (and (fboundp 'md5-string) - (subrp (symbol-function 'md5-string))) - nil - (if (fboundp 'dynamic-link) - (let ((path (expand-file-name "md5.so" exec-directory))) - (and (file-exists-p path) - path))))) +(provide 'md5-dl) +(eval-when-compile (require 'md5)) ; md5-dl-module. (defvar md5-dl-handle (and (stringp md5-dl-module) @@ -49,7 +38,6 @@ (dynamic-call "emacs_md5_init" md5-dl-handle) (defun md5-region (beg end) - (interactive "r") (md5-string (buffer-substring-no-properties beg end))) ;;; Note that XEmacs built-in version takes two more args: CODING and NOERROR. @@ -65,6 +53,4 @@ hash of a portion of OBJECT." (set-buffer object) (md5-region (or beg (point-min)) (or end (point-max)))))) -(provide 'md5-dl) - -;;; md5-dl.el ends here. +;;; md5-dl.el ends here diff --git a/md5.el b/md5.el index 55c658b..28cf11a 100644 --- a/md5.el +++ b/md5.el @@ -49,14 +49,17 @@ ;;; Code: +(defvar md5-dl-module + (if (and (fboundp 'md5) + (subrp (symbol-function 'md5))) + nil + (if (fboundp 'dynamic-link) + (let ((path (expand-file-name "md5.so" exec-directory))) + (and (file-exists-p path) + path))))) + (cond - ((and (fboundp 'md5) - (subrp (symbol-function 'md5))) - ;; recent XEmacs has `md5' as a built-in function. - ;; (and 'md5 is already provided.) - ) - ((and (fboundp 'dynamic-link) - (file-exists-p (expand-file-name "md5.so" exec-directory))) + (md5-dl-module ;; Emacs with DL patch. (require 'md5-dl)) (t diff --git a/sha1-dl.el b/sha1-dl.el index 7edccdd..06f51a2 100644 --- a/sha1-dl.el +++ b/sha1-dl.el @@ -27,10 +27,7 @@ ;;; Code: (provide 'sha1-dl) ; beware of circular dependency. -(eval-when-compile - (require 'sha1) ; sha1-dl-module. - (defun-maybe dynamic-link (a)) - (defun-maybe dynamic-call (a b))) +(eval-when-compile (require 'sha1)) ; sha1-dl-module. (defvar sha1-dl-handle (and (stringp sha1-dl-module) diff --git a/sha1.el b/sha1.el index a7265b6..ad25316 100644 --- a/sha1.el +++ b/sha1.el @@ -42,9 +42,6 @@ (require 'hex-util) -(eval-when-compile - (defun-maybe sha1-string (a))) - (defvar sha1-dl-module (if (and (fboundp 'sha1-string) (subrp (symbol-function 'sha1-string))) -- 1.7.10.4