changeset 15955:32d772cba2c1

(save-match-data): Use save-match-data-internal as the local variable, instead of an uninterned symbol.
author Richard M. Stallman <rms@gnu.org>
date Wed, 28 Aug 1996 22:44:18 +0000
parents 57a05abfc723
children 0cefc98d243d
files lisp/subr.el
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed Aug 28 22:40:09 1996 +0000
+++ b/lisp/subr.el	Wed Aug 28 22:44:18 1996 +0000
@@ -740,13 +740,18 @@
     (start-process name buffer shell-file-name shell-command-switch
 		   (mapconcat 'identity args " ")))))
 
+(defvar save-match-data-internal)
+
+;; We use save-match-data-internal as the local variable because
+;; that works ok in practice (people should not use that variable elsewhere).
+;; We used to use an uninterned symbol; the compiler handles that properly
+;; now, but it generates slower code.
 (defmacro save-match-data (&rest body)
   "Execute the BODY forms, restoring the global value of the match data."
-  (let ((original (make-symbol "match-data")))
-    (list 'let (list (list original '(match-data)))
-	  (list 'unwind-protect
-		(cons 'progn body)
-		(list 'store-match-data original)))))
+  `(let ((save-match-data-variable '(match-data)))
+       (unwind-protect
+	   (progn ,@body)
+	 (store-match-data save-match-data-variable)))))
 
 (defun match-string (num &optional string)
   "Return string of text matched by last search.