From 4175f7db88fc7b7099acb2657aa32167e1ed1027 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 30 Jul 2008 23:48:40 +0000 Subject: [PATCH] (rfc2104-string-make-unibyte): Define it as a compiler macro. (rfc2104-hash): Use it. --- lisp/ChangeLog | 6 ++++++ lisp/rfc2104.el | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a179b87b3..f5f63772e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2008-07-30 Katsumi Yamaoka + + * rfc2104.el (rfc2104-string-make-unibyte): Define it as a compiler + macro. + (rfc2104-hash): Use it. + 2008-07-30 Reiner Steib * gnus-sum.el (gnus-summary-sort-by-most-recent-number) diff --git a/lisp/rfc2104.el b/lisp/rfc2104.el index af6ebd5a8..0339d5983 100644 --- a/lisp/rfc2104.el +++ b/lisp/rfc2104.el @@ -85,6 +85,14 @@ (setq ls (cdr ls))) v)) +(eval-when-compile + (defmacro rfc2104-string-make-unibyte (string) + "Return the unibyte equivalent of STRING. +In XEmacs return just STRING." + (if (featurep 'xemacs) + string + `(string-make-unibyte ,string)))) + (defun rfc2104-hash (hash block-length hash-length key text) (let* (;; if key is longer than B, reset it to HASH(key) (key (if (> (length key) block-length) @@ -100,7 +108,8 @@ (aset ipad i (logxor rfc2104-ipad c)) (aset opad i (logxor rfc2104-opad c))) ;; Perform inner hash. - (setq partial (string-make-unibyte (funcall hash (concat ipad text)))) + (setq partial (rfc2104-string-make-unibyte + (funcall hash (concat ipad text)))) ;; Pack latter part of opad. (do ((r 0 (+ 2 r)) (w block-length (1+ w))) @@ -109,7 +118,7 @@ (+ (* 16 (aref rfc2104-nybbles (aref partial r))) ( aref rfc2104-nybbles (aref partial (1+ r)))))) ;; Perform outer hash. - (string-make-unibyte (funcall hash opad)))) + (rfc2104-string-make-unibyte (funcall hash opad)))) (provide 'rfc2104) -- 2.25.1